You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by antoine philippe chaker <ph...@gmail.com> on 2010/06/10 10:51:00 UTC

Newbie problem

Hi ,
   I just want to know how to pass two parameters to a @POST annotated
method.
Here is the header of the method

    @SuppressWarnings("unchecked")
    @POST
    @Path("/insert/doc1")
    @Consumes( { "application/json", "application/xml", "text/xml" })
    @Produces( { "application/json", "application/xml", "text/xml" })
    public Response MyMethodToInsert(ObjectType1 object_1, ObjectType2
object_2 ) {
....
}

Thanks.

Re: Newbie problem

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

On Thu, Jun 10, 2010 at 9:51 AM, antoine philippe chaker <
philippe.chaker@gmail.com> wrote:

> Hi ,
>   I just want to know how to pass two parameters to a @POST annotated
> method.
> Here is the header of the method
>
>    @SuppressWarnings("unchecked")
>    @POST
>    @Path("/insert/doc1")
>    @Consumes( { "application/json", "application/xml", "text/xml" })
>    @Produces( { "application/json", "application/xml", "text/xml" })
>    public Response MyMethodToInsert(ObjectType1 object_1, ObjectType2
> object_2 ) {
> ....
> }
>
> Do both  parameters represent a body ?

CXF JAXRS does not unwrap individual request body parts (it would be JAXRS
uncompliant anyway), example, given
<someRequest><part1/><part2/></someRequest>

you can only have

public Response MyMethodToInsert(SomeRequest bean) {
....
}

You can have up to one parameter representing a request body and unlimited
number of parameters mapping to various request URI parts or HTTP headers

cheers, Sergey

Thanks.
>

Re: Newbie problem

Posted by antoine philippe chaker <ph...@gmail.com>.
Thank you Jon

2010/6/10 Willard, Jonathan <Jo...@ca.com>

> You can use @QueryParam or @Context UriInfo to get the complete URI if
> for some reason you need to parse it yourself.  See
> http://wikis.sun.com/display/Jersey/Overview+of+JAX-RS+1.0+Features for
> examples.
>
> Jon
>
>
>
>
> -----Original Message-----
> From: antoine philippe chaker [mailto:philippe.chaker@gmail.com]
> Sent: Thursday, June 10, 2010 4:51 AM
> To: users@cxf.apache.org
> Subject: Newbie problem
>
> Hi ,
>   I just want to know how to pass two parameters to a @POST annotated
> method.
> Here is the header of the method
>
>    @SuppressWarnings("unchecked")
>    @POST
>    @Path("/insert/doc1")
>    @Consumes( { "application/json", "application/xml", "text/xml" })
>    @Produces( { "application/json", "application/xml", "text/xml" })
>    public Response MyMethodToInsert(ObjectType1 object_1, ObjectType2
> object_2 ) {
> ....
> }
>
> Thanks.
>

RE: Newbie problem

Posted by "Willard, Jonathan" <Jo...@ca.com>.
You can use @QueryParam or @Context UriInfo to get the complete URI if
for some reason you need to parse it yourself.  See
http://wikis.sun.com/display/Jersey/Overview+of+JAX-RS+1.0+Features for
examples.

Jon
 



-----Original Message-----
From: antoine philippe chaker [mailto:philippe.chaker@gmail.com] 
Sent: Thursday, June 10, 2010 4:51 AM
To: users@cxf.apache.org
Subject: Newbie problem

Hi ,
   I just want to know how to pass two parameters to a @POST annotated
method.
Here is the header of the method

    @SuppressWarnings("unchecked")
    @POST
    @Path("/insert/doc1")
    @Consumes( { "application/json", "application/xml", "text/xml" })
    @Produces( { "application/json", "application/xml", "text/xml" })
    public Response MyMethodToInsert(ObjectType1 object_1, ObjectType2
object_2 ) {
....
}

Thanks.