Author: ivaynberg
Date: Fri Aug 27 05:59:24 2010
New Revision: 990029

URL: http://svn.apache.org/viewvc?rev=990029&view=rev
Log:

Issue: WICKET-1887

Modified:
    
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
    
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java

Modified: 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java?rev=990029&r1=990028&r2=990029&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
 Fri Aug 27 05:59:24 2010
@@ -94,6 +94,8 @@ public class WicketFilter implements Fil
         */
        public static final String FILTER_MAPPING_PARAM = 
"filterMappingUrlPattern";
 
+       public static final String FILTER_PATH_ATTR = 
"org.apache.wicket.filter.path";
+
        /** Log. */
        private static final Logger log = 
LoggerFactory.getLogger(WicketFilter.class);
 
@@ -265,6 +267,8 @@ public class WicketFilter implements Fil
                        httpServletResponse = (HttpServletResponse)response;
                }
 
+               httpServletRequest.setAttribute(FILTER_PATH_ATTR, 
getFilterPath(httpServletRequest));
+
                // If we are a filter which is only meant to process requests 
in a portlet context, and we
                // are in fact not in a portlet context, stop processing now 
and pass to next filter in the
                // chain.

Modified: 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java?rev=990029&r1=990028&r2=990029&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
 Fri Aug 27 05:59:24 2010
@@ -29,6 +29,7 @@ import org.apache.wicket.RequestListener
 import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.protocol.http.WebApplication;
 import org.apache.wicket.protocol.http.WebRequest;
+import org.apache.wicket.protocol.http.WicketFilter;
 import org.apache.wicket.protocol.http.WicketURLDecoder;
 import org.apache.wicket.util.lang.Bytes;
 import org.apache.wicket.util.string.PrependingStringBuffer;
@@ -307,17 +308,21 @@ public class ServletWebRequest extends W
                // stuff, with a leading slash.
                String forwardUrl = 
(String)httpRequest.getAttribute("javax.servlet.forward.servlet_path");
 
-               if (forwardUrl != null && forwardUrl.length() > 0)
+               final String filterPath = 
(String)httpServletRequest.getAttribute(WicketFilter.FILTER_PATH_ATTR);
+
+               if (!Strings.isEmpty(forwardUrl))
                {
                        // If this is an error page, this will be /mount or 
/?wicket:foo
                        relativeUrl = forwardUrl.substring(1);
+                       relativeUrl = 
relativeUrl.substring(filterPath.length());
                }
-               else if (errorUrl != null)
+               else if (!Strings.isEmpty(errorUrl))
                {
                        // Strip off context path from front of URI.
                        errorUrl = 
errorUrl.substring(httpRequest.getContextPath().length());
                        // strip the leading slash
                        relativeUrl = errorUrl.substring(1);
+                       relativeUrl = 
relativeUrl.substring(filterPath.length());
                }
                else if (wicketRedirectUrl != null)
                {


Reply via email to