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-5038) More flexible QueryParams
Date Fri, 24 May 2013 14:44:53 GMT

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

Sergey Beryozkin commented on CXF-5038:
---------------------------------------

Thanks; actually I guess I have all the info now...

QueryParam("") also supports maps; so if you have new unknown parameters, they can be captured
into a map. Re ParamConverter, if you have "a=complex-sequence-1&a=complex-sequence-2",
then List<ComplexA> will work with ParamConverter. Otherwise, if you have ComplexParam.aListproperty
then it has to be QueryParam(""). 
I agree there might be some limitations there, but introducing a 3rd and perfect :-) mechanism
would be a bit too much I think.
Perhaps a simple workaround where ParamConverter.toString() will simply concatenate all list
properties and then in its valueOf method - rebuild the lists will do, example: /request?a=a1+a2+a3,
and on the server side that will be converted into 'a' List with 3 values


                
> More flexible QueryParams
> -------------------------
>
>                 Key: CXF-5038
>                 URL: https://issues.apache.org/jira/browse/CXF-5038
>             Project: CXF
>          Issue Type: New Feature
>          Components: JAX-RS
>            Reporter: Vincent Tremblay
>            Assignee: Sergey Beryozkin
>
> It would be useful to be able to handle how a beans are traduced into QueryParams.
> I can see something like a ParametersWriter<T> and a ParametersReader<T>
to achieve this goal.
> Ex.
> Let's say that you have the following method:
> @GET
> @Path("/resource")
> public void doSomething(@QueryParam ComplexObject);
> You could declare a ParametersWriter that can handle the creation of the parameters:
> public class ParametersWriter<ComplexObject> {
>     
>     writeParameters(ComplexObject object, Map<String, List<Object>> params)
{
>          params.put("filter", Arrays.asList(...,...));
>          params.put("query", Arrays.asList(...));
>     }
> }
> Then, on the server side, you could have a ParametersReader<ComplexObject> that
can rebuild the object from the request's parameters.

--
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

Mime
View raw message