You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2002/09/16 21:00:13 UTC
DO NOT REPLY [Bug 12702] New: -
ActionServlet selects wrong application module from URL
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12702>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12702
ActionServlet selects wrong application module from URL
Summary: ActionServlet selects wrong application module from URL
Product: Struts
Version: 1.1 Beta 2
Platform: All
OS/Version: Other
Status: NEW
Severity: Major
Priority: Other
Component: Controller
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: sditlinger@ebuilt.com
If an application module name begins with the name of another application module
(e.g. foo and foobar are application modules; foobar begins with foo, which is
the name of another module), the ActionServlet may select the wrong application
module for processing by a RequestProcessor. I say "may" because it all
depends on the order of the application module prefixes when they are matched
against the current request.
The offending code can be found in the RequestUtils.selectApplication
(HttpServletRequest request,ServletContext context) method in these lines:
// Match against the list of sub-application prefixes
String prefix = "";
String prefixes[] = getApplicationPrefixes(context);
for (int i = 0; i < prefixes.length; i++) {
if (matchPath.startsWith(prefixes[i])) {
prefix = prefixes[i];
break;
}
}
A different matching test needs to be developed to replace the
simple "startsWith()" call. Some possibilities:
1) Sort the prefix array so that the longest application module names are
searched first
2) Replace "startsWith()" with an equals call on the substring of matchPath
that starts at the beginning and ends at the last "/"
3) Define a "bestStartsWith()" method that finds the longest prefix that passes
the "startsWith()" test
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>