You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by santosh2013 <sa...@gmail.com> on 2013/07/25 16:54:56 UTC

How to set cookie in Camel AHC (Asycn Http Client)

Hi,

I am able to call a REST services using AHC component, but there are some
services which accept cookies 
as part of their request. 

I didn't find info on how to set cookies using AHC component before calling
the web services.
I searched forum, google,stackoverflow as well , but not much info on this.
So finally thought of posting on this forum. 

Should I do something like this :
exchange.getIn().setHeader("Cookie", "name=value") 
Though I have not tried it out yet. I will try this sometime tomorrow , need
to leave for home now.

I was referring to this url: 
http://stackoverflow.com/questions/3467114/how-are-cookies-passed-in-the-http-protocol

If anyone has any info on how to set this , it will be great to know.

Thanks,
Santosh



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-set-cookie-in-Camel-AHC-Asycn-Http-Client-tp5736269.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to set cookie in Camel AHC (Asycn Http Client)

Posted by Santosh Koti <sa...@gmail.com>.
Many thanks Claus for your reply.


Thanks,
Santosh




On Sun, Jul 28, 2013 at 5:53 PM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Yes cookies is just "http headers" so you ought to be able to just use
> camel headers as you code showed.
>
> On Thu, Jul 25, 2013 at 4:54 PM, santosh2013 <sa...@gmail.com>
> wrote:
> > Hi,
> >
> > I am able to call a REST services using AHC component, but there are some
> > services which accept cookies
> > as part of their request.
> >
> > I didn't find info on how to set cookies using AHC component before
> calling
> > the web services.
> > I searched forum, google,stackoverflow as well , but not much info on
> this.
> > So finally thought of posting on this forum.
> >
> > Should I do something like this :
> > exchange.getIn().setHeader("Cookie", "name=value")
> > Though I have not tried it out yet. I will try this sometime tomorrow ,
> need
> > to leave for home now.
> >
> > I was referring to this url:
> >
> http://stackoverflow.com/questions/3467114/how-are-cookies-passed-in-the-http-protocol
> >
> > If anyone has any info on how to set this , it will be great to know.
> >
> > Thanks,
> > Santosh
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/How-to-set-cookie-in-Camel-AHC-Asycn-Http-Client-tp5736269.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>

Re: How to set cookie in Camel AHC (Asycn Http Client)

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yes cookies is just "http headers" so you ought to be able to just use
camel headers as you code showed.

On Thu, Jul 25, 2013 at 4:54 PM, santosh2013 <sa...@gmail.com> wrote:
> Hi,
>
> I am able to call a REST services using AHC component, but there are some
> services which accept cookies
> as part of their request.
>
> I didn't find info on how to set cookies using AHC component before calling
> the web services.
> I searched forum, google,stackoverflow as well , but not much info on this.
> So finally thought of posting on this forum.
>
> Should I do something like this :
> exchange.getIn().setHeader("Cookie", "name=value")
> Though I have not tried it out yet. I will try this sometime tomorrow , need
> to leave for home now.
>
> I was referring to this url:
> http://stackoverflow.com/questions/3467114/how-are-cookies-passed-in-the-http-protocol
>
> If anyone has any info on how to set this , it will be great to know.
>
> Thanks,
> Santosh
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-set-cookie-in-Camel-AHC-Asycn-Http-Client-tp5736269.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen