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: SSO jsessionid and ltpa cookie
Date Thu, 03 Jun 2010 14:56:18 GMT
On Wed, 2010-06-02 at 16:19 -0400, Deschamps.Francois.2@hydro.qc.ca
wrote:
> Hi,
>  
> I am using HttpClient 4. 
>  
> I am using Httpclient from an applet. I'am trying to extract the jsessionid and ltpa
cookie from the browser to pass it to my HttpClient objtect contain in my applet. Of course,
it's not working. Any idea or code sample will be appreciate. Here's the method that take
the cookie and pass it to HttpClient :
>  
>     public void addCookies(String strCookies) {
>         if (strCookies != null & strCookies.length() > 0) {
>             CookieStore cookieStore = new BasicCookieStore();
>  
>             String[] listeCookies = strCookies.split(";");
>             for (int i = 0; i < listeCookies.length; i++) {
>                 String[] unCookie = listeCookies[i].split("=");
>                 if (unCookie != null && unCookie.length == 2) {
>                     BasicClientCookie bcc = new BasicClientCookie(unCookie[0], unCookie[1]);
>                     cookieStore.addCookie(bcc);
>                 }
>             }
>  
>             getHttpContext().setAttribute(ClientContext.COOKIE_STORE, cookieStore);
>         }
>     }
> 
>  
> Thanks,
> Fran├žois

If you do not set correct values for the domain and path attributes, the
cookie will never get matched to the server of origin. 

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