Author: jrthomerson
Date: Thu Dec 16 22:46:17 2010
New Revision: 1050204
URL: http://svn.apache.org/viewvc?rev=1050204&view=rev
Log:
fixes WICKET-3258 for wicket-1.4.x branch
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java
URL:
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java?rev=1050204&r1=1050203&r2=1050204&view=diff
==============================================================================
---
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java
(original)
+++
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java
Thu Dec 16 22:46:17 2010
@@ -247,7 +247,7 @@ public class WebResponse extends Respons
}
else
{
-
httpServletResponse.sendRedirect(url);
+ sendRedirect(url);
}
redirect = true;
}
@@ -264,6 +264,42 @@ public class WebResponse extends Respons
}
/**
+ * Called when Wicket wants to send a redirect to the servlet response.
By default, WebResponse
+ * just calls <code>httpServletResponse.sendRedirect(url)</code>.
However, certain servlet
+ * containers do not treat relative URL redirects correctly (i.e.
WebSphere). If you are using
+ * one of these containers, you can override this method and convert
the relative URL to an
+ * absolute URL before sending the redirect to the servlet container.
+ *
+ * Example of how to fix this for your buggy container (in your
application):
+ *
+ * <pre>
+ * @Override
+ * protected WebResponse newWebResponse(HttpServletResponse
servletResponse)
+ * {
+ * return new WebResponse(servletResponse)
+ * {
+ * @Override
+ * public void sendRedirect(String url) throws IOException
+ * {
+ * String reqUrl =
((WebRequest)RequestCycle.get().getRequest()).getHttpServletRequest()
+ * .getRequestURI();
+ * String absUrl =
RequestUtils.toAbsolutePath(reqUrl, url);
+ * getHttpServletResponse().sendRedirect(absUrl);
+ * }
+ * };
+ * }
+ * </pre>
+ *
+ * @param url
+ * the URL to redirect to
+ * @throws IOException
+ */
+ protected void sendRedirect(String url) throws IOException
+ {
+ httpServletResponse.sendRedirect(url);
+ }
+
+ /**
* Additional header configs for ajax redirects
*/
protected void configureAjaxRedirect()