You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2016/06/21 20:40:58 UTC

[jira] [Comment Edited] (CXF-6941) Send Comma Separated Array in uril request

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

Sergey Beryozkin edited comment on CXF-6941 at 6/21/16 8:40 PM:
----------------------------------------------------------------

I'm not comfortable about supporting it:
- treating a query parameter value with commas in it as a multivalued property *by default* effectively makes it JAX-RS non-compliant.   
- it is a performance hit - every query parameter will need to be parsed, after the whole query has been parsed because it will need to work not only for arrays but also for spec mandated List and Set and for single values too, for example, if you have "a=2&a=3" and declare a String only then it will report the 1st value, '2'. Therefore if you have "a=1,2,3" then it has to work for all the types supported by JAX-RS.
- it is a classical case of the developers thinking that the same (their own framework) will listen on the other end and as such it affects the interoperability as I've already said. Supporting it at the feature level makes them think that it will work end to end but it won't if the server is written as a Servlet - HttpServletRequest will not understand it.

I can only consider supporting it optionally: a property will be introduced which, if set, will enable the runtime to treat a property with a comma-separated value as a multi-valued property. It will be documented as a CXF extension



was (Author: sergey_beryozkin):
I'm not comfortable about supporting it:
- treating a query parameter value with commas in it as a multivalued property *by default* effectively makes it JAX-RS non-compliant.   
- it is a performance hit - every query parameter will need to be parsed, after the whole query has been parsed because it will need to work not only for arrays but only for spec mandated List and Set and for single values too, for example, if you have "a=2&a=3" and declare a String only then it will report the 1st value, '2'. Therefore if you have "a=1,2,3" then it has to work for all the types supported by JAX-RS.
- it is a classical case of the developers thinking that the same (their own framework) will listen on the other end and as such it affects the interoperability as I've already said. Supporting it at the feature level makes them think that it will work end to end but it won't if the server is written as a Servlet - HttpServletRequest will not understand it.

I can only consider supporting it optionally: a property will be introduced which, if set, will enable the runtime to treat a property with a comma-separated value as a multi-valued property. It will be documented as a CXF extension


> Send Comma Separated Array in uril request
> ------------------------------------------
>
>                 Key: CXF-6941
>                 URL: https://issues.apache.org/jira/browse/CXF-6941
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 3.1.6
>         Environment: Mac
>            Reporter: Neal Hu
>             Fix For: 3.2.0, 3.1.8
>
>
> http://stackoverflow.com/questions/11889997/how-to-send-a-array-in-url-request
> Spring MVC and PHP support send comma separated array in the url request:
> http://localhost:8080/MovieDB/GetJson?name=Actor1,Actor2,Actor3&startDate=20120101&endDate=20120505
> @RequestMapping(value = "/GetJson", method = RequestMethod.GET) 
> public void getJson(@RequestParam("name") String[] ticker, @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) {
>    //code to get results from db for those params.
>  }
> Now jax-rs only support below:
> http://localhost:8080/JerseyPojo/jaxrs/BasicResource/test?nameList=xx&nameList=xxx&nameList=ddd
> @Path("/test")
>     @GET
>     public String getQueryList([~getadroit@gmail.com]
> When we migrate from Spring MVC to jax-rs, found problem.
> Neal



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