camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From javakurious <>
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:
> 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:

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, 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. 


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message