You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/05/27 10:30:22 UTC
[1/2] git commit: Implement the deprecated
HttpServletResponse#setStatus(int, String) to delegate to #setStatus(int).
Updated Branches:
refs/heads/master ae7ce5644 -> 172a881f2
Implement the deprecated HttpServletResponse#setStatus(int, String) to delegate to #setStatus(int).
This makes it consistent with all other impls of deprecated methods in MockHttpServlet(Request|Response) and MockHttpSession.
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/172a881f
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/172a881f
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/172a881f
Branch: refs/heads/master
Commit: 172a881f216a94d93b5bec645e29d247bd0d4a51
Parents: 2293764
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon May 27 11:28:23 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon May 27 11:30:13 2013 +0300
----------------------------------------------------------------------
.../protocol/http/BufferedHttpServletResponse.java | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/172a881f/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedHttpServletResponse.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedHttpServletResponse.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedHttpServletResponse.java
index 7e5df5d..cabc78e 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedHttpServletResponse.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedHttpServletResponse.java
@@ -286,8 +286,7 @@ class BufferedHttpServletResponse implements HttpServletResponse
@Deprecated
public void setStatus(int sc, String sm)
{
- throw new UnsupportedOperationException(
- "not supported in the buffered http response, use setStatus(int)");
+ setStatus(sc);
}
/**
[2/2] git commit: WICKET-5203 Base url is incorrect for error
dispatched pages
Posted by mg...@apache.org.
WICKET-5203 Base url is incorrect for error dispatched pages
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/2293764f
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/2293764f
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/2293764f
Branch: refs/heads/master
Commit: 2293764f6a3abdf3492c97c9299f7e8fc043ebcf
Parents: ae7ce56
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon May 27 11:19:41 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon May 27 11:30:13 2013 +0300
----------------------------------------------------------------------
.../protocol/http/servlet/ServletWebRequest.java | 15 +-------
.../http/servlet/ServletWebRequestTest.java | 29 ++++++++++++++-
2 files changed, 28 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/2293764f/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
index 83df540..24947bb 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
@@ -102,20 +102,7 @@ public class ServletWebRequest extends WebRequest
forwardAttributes = ForwardAttributes.of(httpServletRequest, filterPrefix);
- if (forwardAttributes != null || errorAttributes != null)
- {
- if (LOG.isDebugEnabled())
- {
- LOG.debug("Setting filterPrefix('{}') to '' because there is either an error or a forward. {}, {}",
- new Object[] {filterPrefix, forwardAttributes, errorAttributes});
- }
- // the filter prefix is not needed when the current request is internal
- // see WICKET-4387
- this.filterPrefix = "";
- } else
- {
- this.filterPrefix = filterPrefix;
- }
+ this.filterPrefix = filterPrefix;
if (url != null)
{
http://git-wip-us.apache.org/repos/asf/wicket/blob/2293764f/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java b/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
index 8e3cfe1..f974a06 100644
--- a/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
@@ -59,7 +59,7 @@ public class ServletWebRequestTest extends Assert
// simulates a request that has errors metadata
httpRequest.setAttribute("javax.servlet.error.request_uri",
httpRequest.getContextPath() + "/any/source/of/error");
- ServletWebRequest errorWebRequest = new ServletWebRequest(httpRequest, "/");
+ ServletWebRequest errorWebRequest = new ServletWebRequest(httpRequest, "");
Url errorClientUrl = errorWebRequest.getClientUrl();
assertEquals("any/source/of/error", errorClientUrl.toString());
@@ -83,7 +83,6 @@ public class ServletWebRequestTest extends Assert
Url errorClientUrl = errorWebRequest.getClientUrl();
assertEquals("any/source/of/error", errorClientUrl.toString());
-
}
/**
@@ -166,6 +165,32 @@ public class ServletWebRequestTest extends Assert
}
}
+ /**
+ * Tests that {@link ServletWebRequest#getClientUrl()} returns the current url + the query
+ * string when this is not forward dispatched request. When the request is error dispatched it
+ * returns just the request uri to the error page without the query string
+ */
+ @Test
+ public void wicket5203()
+ {
+ String filterPath = "filterPath";
+ MockHttpServletRequest httpRequest = new MockHttpServletRequest(null, null, null);
+ httpRequest.setURL(httpRequest.getContextPath() + '/' + filterPath + "/request/Path");
+ httpRequest.setParameter("some", "parameter");
+
+ ServletWebRequest webRequest = new ServletWebRequest(httpRequest, filterPath);
+ Url clientUrl = webRequest.getClientUrl();
+ assertEquals("request/Path?some=parameter", clientUrl.toString());
+
+ // simulates a request that has errors metadata
+ httpRequest.setAttribute("javax.servlet.error.request_uri",
+ httpRequest.getContextPath() + '/' + filterPath + "/any/source/of/error");
+ ServletWebRequest errorWebRequest = new ServletWebRequest(httpRequest, filterPath);
+ Url errorClientUrl = errorWebRequest.getClientUrl();
+
+ assertEquals("any/source/of/error", errorClientUrl.toString());
+ }
+
private static class CustomRequestPage extends WebPage implements IMarkupResourceStreamProvider
{
private static final long serialVersionUID = 1L;