hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject Re: Issue With HttpClient Session Handling
Date Wed, 08 Dec 2004 10:29:08 GMT
Hello  Manish,

could you be a little more specific about your usage of HttpClient?
Are you using it as a client to connect to a server where your
servlet is running? Or are you using it from a servlet to connect
to a backend server? Are you having problems with the client's
session kept on the server, or with a session of the server which
is kept on a backend server?

Your code fragment does not include the part that is most
important for session handling by HttpClient: which HttpState
object is used when the method is executed? That is where the
cookies are stored, and many servers use cookies to track the

If you are trying to pass headers from a backend server through
your application to a client, you will also have problems with
cookie domains. Assuming three machines in different domains,
the server.at.the.backend will send a cookie for ".at.the.backend".
If the same cookie is returned by "server.in.the.middle", clients
will not accept a cookie for a domain other than ".in.the.middle".


"Manish Moorjani" <Manish_Moorjani@infosys.com> 
08.12.2004 11:11
Please respond to
"HttpClient Project"


Issue With HttpClient Session Handling

I am using HttpClient for automatic login into an application by calling
the Post Method.
PostMethod httpMethod = new PostMethod (strRemoteURL);
httpMethod.addParameter(new NameValuePair("fldUserId",strUserId));
httpMethod.addParameter(new NameValuePair("fldPassword",strPassword));
HttpConnection connConnection
After the execution is successful, I use the following code to set the
response headers
Header[] resHead=httpMethod.getResponseHeaders();
      for(int i=0;i<resHead.length;i++)
Where res is HttpServletResponse .
Everything works fine for me, the cookies get set the browser.
But I am having the following issues
The response is like this
In the test1 I have something like
Which is returning null !!!
It works fine If I access it directly, any inputs on this ????
Manish Moorjani

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message