[jboss-jira] [JBoss JIRA] (WFLY-1833) RestEasy not properly populating request properties.
Bryan Varner (JIRA)
jira-events at lists.jboss.org
Mon Aug 5 16:30:26 EDT 2013
Bryan Varner created WFLY-1833:
----------------------------------
Summary: RestEasy not properly populating request properties.
Key: WFLY-1833
URL: https://issues.jboss.org/browse/WFLY-1833
Project: WildFly
Issue Type: Bug
Components: REST
Affects Versions: 8.0.0.Alpha3
Environment: Wildfly 8.0.0.Alpha3 (debian 7.1, quad-core i5 cpu, oracle-jdk-7)
Reporter: Bryan Varner
Assignee: Stuart Douglas
We have an existing application which functions under AS 7.x.
We have an HTML page that issues 3 rest requests per render to different endpoints on our backend.
The first two requests respond to GET methods using path parameters and function as expected.
{code}
@Path("/logo/")
@RequestScoped
public class LogoFacade {
@GET
@Path("{id}")
@Produces({"image/png"})
public byte[] getImageById(@PathParam("id") Long id) {
...
}
@GET
@Path("name/{name}")
@Produces({"image/png"})
public byte[] getImageByName(@PathParam("name") String name) {
...
}
}
{code}
The third request POSTs form-urlencoded data to a different endpoint, expecting to to get a populated MultivaluedMap<String, String> of the form data.
Instead, we get an *empty map*.
{code}
@Path("/select/")
@Consumes("application/x-www-form-urlencoded")
@Produces({"application/json", "application/xml"})
@RequestScoped
public class SelectionResultFacade {
@POST
@Path("accounts")
@Consumes("application/x-www-form-urlencoded")
public DatatablesResult getAccounts(MultivaluedMap<String, String> params) {
Integer maskLength = Integer.parseInt(params.getFirst("maskLength"));
...
}
}
{code}
This blows up with a null pointer exception, because params is indeed a MultivaluedMap, but it's size() == 0.
Stepping through things with a debugger while loading the page, I was able to trace into the RestEasy code for each of my requests. The internal Request representations were all properly parsing the form data into a map.
Eventually, what I observed was that MethodInjectorImpl is only having it's injectArguments(request, response) called once. I'm making 3 requests, and it appears that the data for the first request being processed is somehow being cached, and the form parameters created for that request (there are none) are being passed to the subsequent requests.
The subsequent requests were never hitting any breakpoint in MethodInjectorImpol.injectArguments()... so I'm seriously confused.
With the help of [~ctomc] I was able to verify that this behavior happens using both jboss-web and undertow.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list