cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-7071) HttpServletRequest.getParameter only get String from query not both posted form data
Date Tue, 28 Mar 2017 11:05:41 GMT

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

Sergey Beryozkin commented on CXF-7071:
---------------------------------------

Neal, FYI, see these tests:

https://github.com/apache/cxf/blob/master/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java#L90

One can read form parameters directly from HttpServletRequest - but having the code being
able to work with form properties as FormParams and read them as HttpServletRequest parameters
at the same time is not possible. I actually can imagine how it can be done - the CXF code
reading the form properties would need to be updated to read them only from CXF HttpServletRequestFilter
code but it would probably break some users' code and possibly some TCK tests and to be honest
I don't see it being needed.  

> HttpServletRequest.getParameter only get String from query not both posted form data
> ------------------------------------------------------------------------------------
>
>                 Key: CXF-7071
>                 URL: https://issues.apache.org/jira/browse/CXF-7071
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.7
>            Reporter: Neal Hu
>            Assignee: Sergey Beryozkin
>             Fix For: 3.1.8, 3.0.11, 3.2.0
>
>
> The http request:
>  POST /dubbott-demo-provider/v1.0/users/beanparam HTTP/1.1
> HOST: localhost:8080
> accept: text/plain
> content-type: application/x-www-form-urlencoded
> content-length: 12
> pageIndex=99
> The resource method returns null:
> {code:java}
>     public String beanParam(@Context HttpServletRequest req, String ak) {
>         String pageIndex = req.getParameter("pageIndex")    
>         return pageIndex;
>     }
> {code}
> From the servlet 3.1 API doc:
> String javax.servlet.ServletRequest.getParameter(String name)
> Returns the value of a request parameter as a String, or null if the parameter does not
exist. Request parameters are extra information sent with the request. For HTTP servlets,
parameters are contained in the query string or posted form data.
> if we add below servlet filter:
> {code:java}
> 	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
> 	        System.out.println(request.getParameter("pageIndex") );
> 		chain.doFilter(request, response);
> 	}
> {code}
> The output is "99" the response is the same "99".
> As a conclusion the CXF HttpServletRequest doesn't comply the Servlet 3.1 API Spec.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message