struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [04/28] struts git commit: Extracts string into constant
Date Thu, 19 Mar 2015 08:50:03 GMT
Extracts string into constant


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/e3428c5f
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/e3428c5f
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/e3428c5f

Branch: refs/heads/master
Commit: e3428c5fe54b9e2b95f5ac1db0e8814118ac7b3c
Parents: 2433789
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Wed Jan 21 08:15:41 2015 +0100
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Wed Jan 21 08:15:41 2015 +0100

----------------------------------------------------------------------
 .../org/apache/struts2/dispatcher/StrutsResultSupport.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/e3428c5f/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java b/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java
index 269ed87..bbcffa3 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java
@@ -110,6 +110,9 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics
{
     /** The default parameter */
     public static final String DEFAULT_PARAM = "location";
 
+    /** use UTF-8 as this is the recommended encoding by W3C to avoid incompatibilities.
*/
+    public static final String DEFAULT_URL_ENCODING = "UTF-8";
+
     private boolean parse;
     private boolean encode;
     private String location;
@@ -240,9 +243,7 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics
{
             if (encode) {
                 if (parsedValue != null) {
                     try {
-                        // use UTF-8 as this is the recommended encoding by W3C to
-                        // avoid incompatibilities.
-                        return URLEncoder.encode(parsedValue, "UTF-8");
+                        return URLEncoder.encode(parsedValue, DEFAULT_URL_ENCODING);
                     }
                     catch(UnsupportedEncodingException e) {
                         if (LOG.isWarnEnabled()) {


Mime
View raw message