[ http://issues.apache.org/struts/browse/WW-1274?page=all ]
     
Don Brown resolved WW-1274:
---------------------------

    Resolution: Not A Problem
     Assign To: Don Brown  (was: Alexandru Popescu)

This isn't a problem, because Struts 2 won't include the ServletDispatcher, and 
as you mentioned, this isn't an issue with the FilterDispatcher.  Thanks 
anyways!

> Wrong end index used when pick path info from the request URI in 
> RequestUtils.getServletPath(request).
> ------------------------------------------------------------------------------------------------------
>
>          Key: WW-1274
>          URL: http://issues.apache.org/struts/browse/WW-1274
>      Project: Struts 2
>         Type: Bug

>   Components: Dispatch
>     Versions: WW 2.2.2
>  Environment: Tomcat 5.5.16 + WebWork 2.2.2 
>     Reporter: Parker Wang
>     Assignee: Don Brown
>     Priority: Minor
>      Fix For: 2.0.0

>
> When using ServletDispatcher with RestfulActionMapper and the servlet is 
> mapped to url pattern "/*", I got problem in mapping URL to actions.
> The RestfulActionMapper will call RequestUtils.getServletPath(request) to get 
> the path info. As request.getServletPath() will return an empty string in 
> this case, the method would try to pick path info from the uri by calculating 
> the start index and the end index:
>         int endIndex = request.getPathInfo() == null ? requestUri.length() : 
> requestUri.lastIndexOf(request.getPathInfo());
> The method String.lastIndexOf(str) here returns the index of the FIRST 
> character of last occurrence of path info.
> So requestUri.substring(startIndex, endIndex) would return the substring 
> between the context and the path, usually an empty string "", which made the 
> RestfulActionMapper failed to build an actionMapping.
> I think the right way is as done by DefaultActionMapper.getUri(request).
>         uri = request.getRequestURI();
>         return uri.substring(request.getContextPath().length());

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to