[
https://issues.apache.org/jira/browse/WW-4585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15096366#comment-15096366
]
Rich P Peters, II edited comment on WW-4585 at 1/13/16 3:44 PM:
----------------------------------------------------------------
my mistake... try this one
{code:java}
public void testGetJsessionIdSemicolonMappingWithMethod() throws Exception {
req.setRequestURI("/myapp/animals/dog/fido!update;jsessionid=29fefpv23do1g");
req.setServletPath("/animals/dog/fido");
req.setMethod("GET");
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}
gives
{code:java}
junit.framework.ComparisonFailure: null
Expected :update
Actual :show
<Click to see difference>
at junit.framework.Assert.assertEquals(Assert.java:81)
at junit.framework.Assert.assertEquals(Assert.java:87)
at
org.apache.struts2.rest.RestActionMapperTest.testGetJsessionIdSemicolonMappingWithMethod(RestActionMapperTest.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
}
{code}
was (Author: rpii):
my mistake... try this one
{code:java}
public void testGetJsessionIdSemicolonMappingWithMethod() throws Exception {
req.setRequestURI("/myapp/animals/dog/fido!update;jsessionid=29fefpv23do1g");
req.setServletPath("/animals/dog/fido");
req.setMethod("GET");
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());
gives
junit.framework.ComparisonFailure: null
Expected :update
Actual :show
<Click to see difference>
at junit.framework.Assert.assertEquals(Assert.java:81)
at junit.framework.Assert.assertEquals(Assert.java:87)
at
org.apache.struts2.rest.RestActionMapperTest.testGetJsessionIdSemicolonMappingWithMethod(RestActionMapperTest.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
}
> Struts2 Rest plugin doesnt handle JSESSIONID
> --------------------------------------------
>
> 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
> Priority: Blocker
> Fix For: 2.3.25
>
>
> If a url 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 testGetJsessionIdSemicolonMapping() throws Exception {
> req.setRequestURI("/myapp/animals/dog/fido;jsessionid=29fefpv23do1g");
> req.setServletPath("/animals/dog/fido");
> req.setMethod("GET");
> ActionMapping mapping = mapper.getMapping(req, configManager);
> assertEquals("/animals", mapping.getNamespace());
> assertEquals("dog", mapping.getName());
> assertEquals("fido", ((String[]) mapping.getParams().get("id"))[0]);
> assertEquals("show", mapping.getMethod());
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)