struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rich P Peters, II (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (WW-4585) Struts2 Rest plugin doesn't handle JSESSIONID with DMI
Date Thu, 14 Jan 2016 22:18:39 GMT

    [ https://issues.apache.org/jira/browse/WW-4585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15099003#comment-15099003
] 

Rich P Peters, II edited comment on WW-4585 at 1/14/16 10:18 PM:
-----------------------------------------------------------------

Aleksander,  thanks for the fix.  I tested it, and it showed another issue which I had addressed
in the code I provided:
Here is a test of it.  would you like me to file a separate issue for this?

The code I provided actually fixed a second issue with a complex id:

{code:java}
    public void testMappingWithMethodAndId() throws Exception {
        req.setRequestURI("/myapp/animals/dog/fido/test/some-url!update;jsessionid=29fefpv23do1g");
        req.setServletPath("/animals/dog/fido/test/some-url");
        req.setMethod("GET");
        mapper.setAllowDynamicMethodCalls("true");
        ActionMapping mapping = mapper.getMapping(req, configManager);

        assertEquals("/animals", mapping.getNamespace());
        assertEquals("dog", mapping.getName());
        assertEquals("fido/test/some-url", ((String[]) mapping.getParams().get("id"))[0]);
        assertEquals("update", mapping.getMethod());
    }
{code}
Here is the test:

{code:java}
junit.framework.ComparisonFailure: null 
Expected :dog
Actual   :dog/fido
  <Click to see difference>
{code}


was (Author: rpii):
Aleksander,  thanks for the fix.  I tested it, and it showed another issue which I had addressed
in the code I provided:
Here is a test of it.  would you like me to file a separate issue for this?

The code I provided actually fixed a second issue with a complex id:

{code:java}
    public void testMappingWithMethodAndId() throws Exception {
        req.setRequestURI("/myapp/animals/dog/fido/test/some-url!update;jsessionid=29fefpv23do1g");
        req.setServletPath("/animals/dog/fido/test/some-url");
        req.setMethod("GET");
        mapper.setAllowDynamicMethodCalls("true");
        ActionMapping mapping = mapper.getMapping(req, configManager);

        assertEquals("/animals", mapping.getNamespace());
        assertEquals("dog", mapping.getName());
        assertEquals("fido/test/some-url", ((String[]) mapping.getParams().get("id"))[0]);
        assertEquals("update", mapping.getMethod());
    }
{code}

> Struts2 Rest plugin doesn't handle JSESSIONID with DMI
> ------------------------------------------------------
>
>                 Key: WW-4585
>                 URL: https://issues.apache.org/jira/browse/WW-4585
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - REST
>    Affects Versions: 2.3.24
>         Environment: tomcat
>            Reporter: Rich P Peters, II
>            Assignee: Aleksandr Mashchenko
>            Priority: Blocker
>             Fix For: 2.3.25, 2.5
>
>         Attachments: RestActionMapper.java
>
>
> If a url with DMI and with a JSESSIONID is sent to a Struts2 action, a failure will result
> see this modified unit test from the plugin unit test:
> {code:java}
>     public void testGetJsessionIdSemicolonMappingWithMethod() throws Exception {
>         req.setRequestURI("/myapp/animals/dog/fido!update;jsessionid=29fefpv23do1g");
>         req.setServletPath("/animals/dog/fido");
>         req.setMethod("GET");
>         mapper.setAllowDynamicMethodCalls("true");
>         ActionMapping mapping = mapper.getMapping(req, configManager);
>         assertEquals("/animals", mapping.getNamespace());
>         assertEquals("dog", mapping.getName());
>         assertEquals("fido", ((String[]) mapping.getParams().get("id"))[0]);
>         assertEquals("update", mapping.getMethod());
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message