RE: java session question
If the session ID was in a header called "set-cookie"(and it probably was) set it as the cookie when you send the next request:
urlConnection.setRequestProperty("Cookie", sessionID);
Now when you make subsequent requests to the server the server will recognize you as the client that had received that session ID.
//how to Collect the "set-cookie" from the response for the first time
if (urlConnection != null)
{
for (int i = 1;(key = urlConnection.getHeaderFieldKey(i)) != null; i++)
{
System.out.println(urlConnection1.getHeaderFieldKey(i) + ": " + urlConnection.getHeaderField(key));
if (key.equalsIgnoreCase("set-cookie"))
{
String cookiValue = urlConnection1.getHeaderField(key);
}
}
//How to set the cookie value in the subsequent requests
urlConnection2.setRequestProperty("Cookie", cookiValue);
Nazeer Syed
Web Developer
(T) 201 269 5764
-----Original Message-----
From: Eswaran, Sriram
Sent: Friday, November 04, 2005 10:47 AM
To: Syed, Nazeer
Subject: java session question
Can a jsp or servlet be invoked from another non-java system using a session id? Basically how will they pass the session id to the jsp?
Sriram Eswaran
E-Commerce Senior Application Architect
Medco Health Solutions, Inc.
phone: (201)269-5415
email: sriram_eswaran@medcohealth.com

<< Home