camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: exposing same REST service as both GET and POST
Date Wed, 08 Aug 2012 08:27:05 GMT
Hi
On 08/08/12 00:36, javakurious wrote:
> Based on the example in  http://camel.apache.org/cxfrs.html cxfrs example
> with camel , I created a REST service exposed as GET operation. Here is the
> overview of what I have so far :
>
> REST endpoint in Camel:
> <cxf:rsServer id="custmoer-rest-get-server"
>    address="/" serviceClass="com.personal.test.impl.CustomerGETImpl"/>
>
> And the corresponding resource class used to configure the endpoint...
>
> CustomerGETImpl
>      @GET
>      @Path("/Customer")
>      @Produces("text/xml")
>      @Override
>      public Response getCustomer(@QueryParam("CustomerName") String
> customerName)
>      }
>
> It works fine.
>
> My question is if I have to expose the same service as POST as well, what do
> I have to do ?
>
> I did the following :
>
> 1)Added additional REST endpoint in Camel:
> <cxf:rsServer id="custmoer-rest-get-server"
>    address="/" serviceClass="com.personal.test.impl.CustomerGETImpl"/>
> <cxf:rsServer id="custmoer-rest-post-server"
>    address="/" serviceClass="com.personal.test.impl.CustomerPOSTImpl"/>
>

This is unlikely to work correctly given both servers are not related to 
each other but have the same relative address

> 2)Created a new corresponding resource class used to configure the
> endpoint...
>
> CustomerPOSTImpl
>      @POST
>      @Path("/Customer")
>      @Produces("text/xml")
>      @Override
>      public Response getCustomer(@FormParam("CustomerName") String
> customerName)
>      }
>
> If I deploy this configuration, the POST works but GET return status 405.
>
> Can anybody shed some light on what I am doing wrong.
>
Try having a single service implementation with GET & POST handlers, 
that should work

Cheers, Sergey

> Thanks
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/exposing-same-REST-service-as-both-GET-and-POST-tp5716952.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message