[
https://issues.apache.org/jira/browse/CXF-2993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12913266#action_12913266
]
Sergey Beryozkin commented on CXF-2993:
---------------------------------------
Hi - please see
systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
on the trunk with a test confirming that parameters can be retrieved from
HttpServletContext if no MultivaluedMap is provided.
Can you please recheck once again that
public Response createRating( @Context HttpServletRequest requestObject,
@Context HttpServletResponse response){
System.out.println(requestObject.getParameterMap()); //This print out an empty
map {}, IT SHOULD BE {"itemId":"blah"}
}
}
does not give the populated map ?
CXF will get the parameters if MultivaluedMap or @Form parameters are used in
case InputStream is empty - this is per the JAXRS 1.1 requirements. But it
definitely should not consume them if only HttpServletRequest is provided...
can you recheck please and may be even debug if the problem persists ?
> @Context HttpServletRequest does not contain POST data. It's however is in
> MultivaluedMap<String, String> .
> ------------------------------------------------------------------------------------------------------------
>
> Key: CXF-2993
> URL: https://issues.apache.org/jira/browse/CXF-2993
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 2.2.9, 2.2.10
> Environment: Dev
> Reporter: John Tran
>
> I try to use @Context HttpServletRequest from my JAX-RS method to retrieve
> POST data but it's not there. It's however is in MultivaluedMap<String,
> String> parameterMap
> Here is the code.
> @Resource
> @Path("/rating")
> public class RatingRs {
> @Path("/create")
> @POST
> @Consumes("application/x-www-form-urlencoded")
> @Produces("application/json")
> public void createRating( @Context HttpServletRequest requestObject,
> @Context HttpServletResponse response, MultivaluedMap<String, String>
> parameterMap){
>
> Map map = requestObject.getParameterMap(); //THIS RETURNS EMPTY, WHY?
> SHOULD CONTAIN "itemId"="blah"
> String itemId = requestObject.getParameter("itemId"); //returns null
> SHOULD NOT BE NULL
> List values = parameterMap.get("itemId"); //RETURNS THE CORRECT VALUE
> HERE.
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.