camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From javakurious <javakuri...@gmail.com>
Subject exposing same REST service as both GET and POST
Date Tue, 07 Aug 2012 21:36:59 GMT
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"/>

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. 

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