You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by mansoor khan <ma...@yahoo.com> on 2007/07/29 15:23:34 UTC

HttpClient: Session not accessible

Hallo Oleg,

how are you. i got your email from the mailing list archive.

I am stuck with a problem....

Background:
-----------------
User is logged into the WebApplication from browser and the application authenticate the user and keep the authenticated user with some more information in the Session. (for login i am using loginServlet)

request.getSession().setAttribute("UserSession", objUser );

User can upload file using applet...and i am using HttpClient and MultipartPostMethod classes for uploading file ....  both of these classes objects are created in the applet, connect to the server and send the data to servlet ....
the code is working fine...

Problem :
-------------
 the problem is i need user session (having information which i keep in the Session at the time of login)  for file uploading which i don't get when i post data through applet using HttpClient.

During search i found the HttpState class  ... but i don't understand how it will work in my case.

any suggestion please ... or any code chunk

Regards
Mansoor


       
---------------------------------
Shape Yahoo! in your own image.  Join our Network Research Panel today!

Re: HttpClient: Session not accessible

Posted by Roland Weber <os...@dubioso.net>.
Hello Mansoor,

> the problem is i need user session (having information which i keep in the
> Session at the time of login)  for file uploading which i don't get when i
> post data through applet using HttpClient.

There's the problem: Applet. When you use HttpURLConnection, the
Java Plugin will pick up the cookies from the browser and send
them along with the request. HttpClient cannot do that, and so
your request is most likely missing the browser session cookie.

> During search i found the HttpState class ... but i don't understand how it
> will work in my case.

Here's a starting point for your searching the mailing list archives:
http://mail-archives.apache.org/mod_mbox/jakarta-httpclient-user/200608.mbox/%3c1155031682.4960.34.camel@localhost.localdomain%3e

That user already found a way to pass the cookie from
the browser/HTML page to the applet. Maybe the "how"
is mentioned in a previous discussion on the list.
This one also has a hint:
http://forum.springframework.org/showthread.php?t=14931

Good search terms for your problem should be "applet"
and "session cookie".

hope that helps,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org