Discussion:
how get cookie JSESSIONIDSSO ?
Scott Lee
2014-09-25 19:03:57 UTC
Permalink
Hello,
Using the HttpClient example ClientFormLogin.java, I'm trying to get
the cookie JSESSIONIDSSO.
It only returns JSESSIONID.

$ java -cp .:./httpcomponents-client-4.3.5 ClientFormLogin
Login form get: HTTP/1.1 200 OK
Initial set of cookies:
- [version: 0][name: JSESSIONID][value:
03CAFE4E15CB1EF1A265884F9B7C593C][domain: site.com][path: /][expiry:
null]

Login form get: HTTP/1.1 200 OK
Post logon cookies:
- [version: 0][name: JSESSIONID][value:
03CAFE4E15CB1EF1A265884F9B7C593C][domain: site.com][path: /][expiry:
null]

The example code is at
http://hc.apache.org/httpcomponents-client-4.3.x/httpclient/examples/org/apache/http/examples/client/ClientFormLogin.java

In this code, I commented out 'package
org.apache.http.examples.client;', changed the URL (it's a http site,
not https), username, and pw.

Using chrome javascript console, site.com gives the JSESSIONID at the
login page.
Once successfully logged in, it returns JSESSIONIDSSO

So I expected this call at post-logon to return both JSESSIONID and
JSESSIONIDSSO
cookieStore.getCookies()

Here's the output from the javascript console, private data removed.
Remote Address: 123.123.123.123
Request URL:http://site.com/
Request Method:GET
Status Code:200 OK

Request Headers
GET / HTTP/1.1
Host: site.com
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/37.0.2062.103 Safari/537.36
Referer: http://site.com/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Cookie: PREV_CONTEXT_PATH=; JSESSIONID=AD324DC2BEBC40902F46C9A5316B8F2C

Response Headers
HTTP/1.1 200 OK
Date: Wed, 10 Sep 2014 15:36:31 GMT
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Wed, 31 Dec 1969 18:00:00 CST
X-Powered-By: Servlet 2.4; Tomcat-5.0.28/JBoss-3.2.6 (build:
CVSTag=JBoss_3_2_6 date=200410140106)
Content-Type: text/html;charset=UTF-8
Content-Length: 670
Set-Cookie: JSESSIONIDSSO=F2198F339E74DD75ED1A9FE85D4D64D6; Path=/
Keep-Alive: timeout=300, max=1022
Connection: Keep-Alive

Thank you for any assistance!

Loading...