You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Gabo Manuel <km...@solegysystems.com> on 2010/02/03 11:51:52 UTC

[CXF2.2.5][JAX-RS] On parameter type

Hi All,

A few questions:

1. On methods annotated as POST/PUT/DELETE, should the parameters be 
using @QueryParam or @FormParam. I see no compilation error in using 
both, but I see no change in the generated WADL. Actuallt, using 
@FormParam still yields the WADL generated as style="query"

2. I noticed that with the generated WADL, complex objects are 
represented as follows:
<param name="null" style="request_body"/>

Is it possible through annotation, to supply a name? Using @MatrixParam 
also changes the style, not sure if this is the same as before.

Gabo


Re: [CXF2.2.5][JAX-RS] On parameter type

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi

> Hi All,
>
> A few questions:
>
> 1. On methods annotated as POST/PUT/DELETE, should the parameters be using @QueryParam or @FormParam. I see no compilation error 
> in using both,

It is really up to the developer. I don't think CXF should try to enforce some kind of 'best practice' on individual resources. I 
would not be surprised if some services existed which accepted either Query or Form params with both PUT and POST, afaik there's 
been some devs in HTML 5.0 forms (can't confirm) to do with PUTs being also supported, etc. A CXF user asked awhile back about 
@DELETE methods not accepting queries....

> but I see no change in the generated WADL. Actuallt, using @FormParam still yields the WADL generated as style="query"

See a table in http://www.w3.org/Submission/wadl/#x3-270002.12.2 (parameter of type 'query' with 'representation' parents)


>
> 2. I noticed that with the generated WADL, complex objects are represented as follows:
> <param name="null" style="request_body"/>
>
> Is it possible through annotation, to supply a name?

This is a bug, can you please show the corresponding method signature ? It really should not happen but I've just looked at the 
source, it might be that if you have a method like this :

@Consumes("application/x-www-form-urlencoded")
void form(@FormParam("a"), @FormParam("b"), SomeObject someBody)

or

@Consumes("application/x-www-form-urlencoded")
void form(MultivaluedMap map)

I've added a check to the code to ensure no bogus <param name="null" style="request_body"/> is printed...Generally, request bodies 
are mapped to representation elements

>
> Using @MatrixParam also changes the style, not sure if this is the same as before.

@MatrixParam should have a 'matrix' style

cheers, Sergey

>
> Gabo
>