You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Omkar Patil (JIRA)" <ji...@apache.org> on 2007/11/20 10:55:33 UTC

[jira] Commented: (WW-2328) Server returns 404 error when the action URL has the format xxx.action;jsessionid=yyy

    [ https://issues.apache.org/struts/browse/WW-2328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42691 ] 

Omkar Patil commented on WW-2328:
---------------------------------

After revision 586739, as the method RequestUtils.getServletPath(HttpServletRequest) returns the path parameters (like ;jsessionid=yyy) in the result,  the getMapping method in DefaultActionMapper is returning null. Here is the code snippet from that method where it all happens -

    String uri = getUri(request);
    uri = dropExtension(uri, mapping);
    if (uri == null) {
        return null;
    }

The getUri method internally calls the RequestUtils.getServletPath method and as a result receives uri with path parameters still on.The dropExtension method just checks if the uri passed in ends with action extension, and strips the extension if present. 

Possible fix would be once the uri is returned from getUri call, we can strip off the the extra information such as path parameters from it and then pass it into the dropExtension method. With this fix we can avoid making changes to the RequestUtils.getServletPath(HttpServletRequest) method as it may have been used by other parts of the code which expect the uri with path parameters as well.

I can provide a patch for this in couple of days.

> Server returns 404 error when the action URL has the format xxx.action;jsessionid=yyy
> -------------------------------------------------------------------------------------
>
>                 Key: WW-2328
>                 URL: https://issues.apache.org/struts/browse/WW-2328
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>    Affects Versions: 2.1.x
>         Environment: Windows XP, JDK 1.5, maven 2.0.7, Jetty 6.1.5, Struts 2.1.1-SNAPSHOT
>            Reporter: Thai Ha
>            Priority: Blocker
>             Fix For: 2.1.1
>
>         Attachments: sample.zip
>
>
> Scenario:
> When the URL has the format of (xxx.action;jsessionid=yyy), the corresponding action mapping cannot be found by Dispatch Filter, as a result, the error 404 is returned. This error happens on Struts 2.1.1-SNAPSHOT, but not happens on Struts 2.0.x.
> Root cause:
> From the SVN history, I see the change at http://svn.apache.org/repos/asf/struts/struts2/trunk/core/src/main/java/org/apache/struts2/RequestUtils.java (revision 586739) makes the method RequestUtils.getServletPath(HttpServletRequest) returns the path parameters (like ;jsessionid=yyy) (if any) in the result. And the Dispatch Filter doesn't remove the path parameters before lookup action mapping. So if the request contains path parameters like (;jsessionid=), the action mapping will not be found, and the error 404 will be returned.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.