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
François Deschamps
Conseiller en TI,
Centre d'expertise Java (DMDI)
Hydro-Québec
tel: 514-840-3000 (4756)
courriel: [email protected]
<mailto:[email protected]>