[
https://issues.apache.org/jira/browse/WICKET-3881?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sven Meier updated WICKET-3881:
-------------------------------
Description:
Tomcat reports a bogus servletPath for a filter iff
- welcome files are listed in web application of Tomcat's defaults
- a welcome file exists (e.g. index.html)
- a request comes in with an empty path
Example:
"/" results in servletPath "/index.html"
See https://issues.apache.org/bugzilla/show_bug.cgi?id=50161 for a discussion.
Due to the bogus servletPath redirects are failing. For a test you can run
wicket-examples with SignApplication mapped to root:
<filter-mapping>
<filter-name>SignInApplication</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
The attached quickstart shows a possible workaround, see attached patch.
was:
continueToOriginal() leaves the current web context on Tomcat, see attached
quickstart.
Evaluation:
In ServletWebRequest#getRelativePathPrefixToContextRoot() the servletPath is
used:
String servletPath = getServletPath();
if (servletPath.endsWith(path))
{
int len = servletPath.length() - path.length() - 1;
if (len < 0)
{
len = 0;
}
wicketPath = servletPath.substring(0, len);
}
Problem is that Tomcat returns "/index.html" as servletPath when:
- Wicket is running as filter (as usual)
- request path is ""
- welcome-file-list contains "index.html" (in web.xml or Tomcat's default)
- index.html exists
Note: Jetty would return "/". For more info see here:
https://issues.apache.org/bugzilla/show_bug.cgi?id=50161
The code above will evaluate wicketPath as "/index.htm" (should be ""), thus
leading the following calculation to prepend an erroneous additional "../".
I've added a temporary workaround to my project by simply removing the
index.html. But I'm really not sure what's the best way to fix this problem in
Wicket.
Note that this problem does not exist with Wicket 1.5.
Summary: ServletWebRequest#getServletPath must handle bogus servlet
path for filter on Tomcat (was: continueToOriginal() leaves context on Tomcat)
> ServletWebRequest#getServletPath must handle bogus servlet path for filter on
> Tomcat
> ------------------------------------------------------------------------------------
>
> Key: WICKET-3881
> URL: https://issues.apache.org/jira/browse/WICKET-3881
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 1.4.17
> Environment: Tomcat 5,6 and 7
> Reporter: Sven Meier
> Assignee: Sven Meier
> Attachments: tomcatservletpath.zip
>
>
> Tomcat reports a bogus servletPath for a filter iff
> - welcome files are listed in web application of Tomcat's defaults
> - a welcome file exists (e.g. index.html)
> - a request comes in with an empty path
> Example:
> "/" results in servletPath "/index.html"
> See https://issues.apache.org/bugzilla/show_bug.cgi?id=50161 for a discussion.
> Due to the bogus servletPath redirects are failing. For a test you can run
> wicket-examples with SignApplication mapped to root:
> <filter-mapping>
> <filter-name>SignInApplication</filter-name>
> <url-pattern>/*</url-pattern>
> <dispatcher>REQUEST</dispatcher>
> <dispatcher>INCLUDE</dispatcher>
> </filter-mapping>
> The attached quickstart shows a possible workaround, see attached patch.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira