hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: How do you set cookies on initial post in HttpClient?
Date Sun, 22 Feb 2009 16:14:06 GMT
Scott Mueller wrote:
> By the way, this example code of setting cookies in HttpClient doesn't work
> either:
> http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientCustomContext.java
> 
> I copied the code there like this:
>         DefaultHttpClient client = new DefaultHttpClient();
>         CookieStore cookieStore = new BasicCookieStore();
>         cookieStore.addCookie(new BasicClientCookie("JSESSIONID",
> getParameter("session")));
>         HttpContext context = new BasicHttpContext();
>         context.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
>         client.execute(post, context);
> 
> Again, no cookies are specified on the http post.  All I want to do is
> attach the applet to the same session as the browser.  Is there a better way
> to do this?  Are cookies functional in HttpClient beta 2?
> 

Yes, they are.

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message