[1/2] struts git commit: Extracts string into constant
Repository: struts Updated Branches: refs/heads/develop 243378937 -> 0f44e11cd 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/develop Commit: e3428c5fe54b9e2b95f5ac1db0e8814118ac7b3c Parents: 2433789 Author: Lukasz Lenart Authored: Wed Jan 21 08:15:41 2015 +0100 Committer: Lukasz Lenart 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()) {
[2/2] struts git commit: WW-4448 Strips params and replaces spaces
WW-4448 Strips params and replaces spaces Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/0f44e11c Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/0f44e11c Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/0f44e11c Branch: refs/heads/develop Commit: 0f44e11cd1f3cff51ed4a2a10dec593d8822ade2 Parents: e3428c5 Author: Lukasz Lenart Authored: Wed Jan 21 08:46:49 2015 +0100 Committer: Lukasz Lenart Committed: Wed Jan 21 08:46:49 2015 +0100 -- .../dispatcher/ServletRedirectResult.java | 6 +++- .../dispatcher/ServletRedirectResultTest.java | 30 2 files changed, 35 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/0f44e11c/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java -- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java index b6cd282..60f5584 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java @@ -272,7 +272,11 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec */ protected boolean isPathUrl(String url) { try { -URI uri = URI.create(url); +String rawUrl = url; +if (url.contains("?")) { +rawUrl = url.substring(0, url.indexOf("?")); +} +URI uri = URI.create(rawUrl); if (uri.isAbsolute()) { URL validUrl = uri.toURL(); if (LOG.isDebugEnabled()) { http://git-wip-us.apache.org/repos/asf/struts/blob/0f44e11c/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java -- diff --git a/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java index 56cfe9d..ab40dfc 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java @@ -100,6 +100,36 @@ public class ServletRedirectResultTest extends StrutsInternalTestCase implements } } +public void testFullUrlRedirectWithSpaces() { +view.setLocation("http://localhost/bar/foo some.pdf"); +responseMock.expectAndReturn("encodeRedirectURL", C.args(C.eq("http://localhost/bar/foo some.pdf")), "http://localhost/bar/foo some.pdf"); +responseMock.expect("sendRedirect", C.args(C.eq("http://localhost/bar/foo some.pdf"))); + +try { +view.execute(ai); +requestMock.verify(); +responseMock.verify(); +} catch (Exception e) { +e.printStackTrace(); +fail(); +} +} + +public void testFullUrlRedirectWithParams() { +view.setLocation("http://localhost/bar/foo.action?param=1¶m 2=3"); +responseMock.expectAndReturn("encodeRedirectURL", C.args(C.eq("http://localhost/bar/foo.action?param=1¶m 2=3")), "http://localhost/bar/foo.action?param=1¶m 2=3"); +responseMock.expect("sendRedirect", C.args(C.eq("http://localhost/bar/foo.action?param=1¶m 2=3"))); + +try { +view.execute(ai); +requestMock.verify(); +responseMock.verify(); +} catch (Exception e) { +e.printStackTrace(); +fail(); +} +} + public void testAbsoluteRedirect303() { view.setLocation("/bar/foo.jsp"); view.setStatusCode(303);
[1/2] struts git commit: change findBaseAccessor method
Repository: struts Updated Branches: refs/heads/develop 0f44e11cd -> d9973fee0 change findBaseAccessor method in hibernate4.3.7,because javassist3.18.1's class name generate rule is '_$$_jvst'+... Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/b8882758 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/b8882758 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/b8882758 Branch: refs/heads/develop Commit: b8882758036a1abe86c5405889410c55da958a80 Parents: 2433789 Author: aronshen Authored: Tue Jan 20 11:54:10 2015 +0800 Committer: aronshen Committed: Tue Jan 20 11:54:10 2015 +0800 -- .../main/java/org/apache/struts2/json/JSONWriter.java | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/b8882758/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java -- diff --git a/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java b/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java index fd9b844..dc53967 100644 --- a/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java +++ b/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java @@ -305,7 +305,18 @@ public class JSONWriter { } catch (Exception ex) { LOG.debug(ex.getMessage(), ex); } -} else { + +//in hibernate4.3.7,because javassist3.18.1's class name generate rule is '_$$_jvst'+... +} else if(clazz.getName().contains("$$_jvst")){ +try { +baseAccessor = Class.forName( +clazz.getName().substring(0, clazz.getName().indexOf("_$$"))) +.getMethod(accessor.getName(), accessor.getParameterTypes()); +} catch (Exception ex) { +LOG.debug(ex.getMessage(), ex); +} +} +else { return accessor; } return baseAccessor;
[2/2] struts git commit: WW-4449 Extends JSONWriter to support Javassist 3.18.1 and Hibernate 4.3.7
WW-4449 Extends JSONWriter to support Javassist 3.18.1 and Hibernate 4.3.7 Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/d9973fee Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/d9973fee Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/d9973fee Branch: refs/heads/develop Commit: d9973fee06eb07fee35226b5b9037c4ce3614aed Parents: 0f44e11 b888275 Author: Lukasz Lenart Authored: Wed Jan 21 08:54:09 2015 +0100 Committer: Lukasz Lenart Committed: Wed Jan 21 08:54:09 2015 +0100 -- .../main/java/org/apache/struts2/json/JSONWriter.java | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) --