camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From javakurious <javakuri...@gmail.com>
Subject Re: camel cxfrs : setting a cookie in the http response
Date Tue, 10 Jul 2012 17:23:13 GMT

Sergey Beryozkin-3 wrote
> 
> 
> The simplest option is to do something like
> 
> @GET
>        @Path("/getCustomer")
>        @Produces("text/xml")
>        public Response getCustomer(
>                @PathParam("name") String street,
>                @CookieParam("a") String aCookie) {
>            if (aCookie == null) {
>               // do some work
>               return Response.ok(someEntity).header("Set-Cookie", 
> "a=b;Path=/services;Secure").build();
>            } else {
>               // use aCookie to identify the user state
>            }
>        }
> 
> Here is some more info:
> http://cxf.apache.org/docs/jax-rs-basics.html
> 
> I believe that in Camel you can also use custom processors to set the 
> out headers which I guess can let working with other HTTP components 
> easier, however I agree it can be handy getting it all done inside a 
> JAX-RS handler
> 
> HTH, Sergey
> 
> Blog: http://sberyozkin.blogspot.com
> 

Problem with @CookieParam solution is that I don't have an implementation of
these methods in the class. These methods don't get called. I specify these
methods just to configure jaxrs properties. The actual response is returned
by the camel route. So, I am looking to use @HttpHeader context injection in
one of the processor in the camel route. 

If I use org.springframework.http.HttpHeaders, there is no getCookies()
method, if I use javax.ws.rs.core.HttpHeaders, then it is not getting
injected by camel. 

So, I am still not sure how to set a cookie in the http response, for client
to send it back in the next request. 

Thanks


--
View this message in context: http://camel.465427.n5.nabble.com/camel-cxfrs-setting-a-cookie-in-the-http-response-tp5715788p5715819.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message