aspose file tools*
The moose likes Servlets and the fly likes send session from applet to servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "send session from applet to servlet" Watch "send session from applet to servlet" New topic
Author

send session from applet to servlet

Sean McGarvey
Greenhorn

Joined: Jun 15, 2005
Posts: 9
I have a web application that uses applets and servlets. When I use getAppletContext().showDocument() to send a url to my servlet, the servlet cannot retireve the session information using session.getAttribute(). In fact, request.getSession(false) returns null.

This seems to be working properly on IIS, but when I try to configure Apache, it fails unless the client is running on the server.

Any ideas would be greatly appreciated.

Thank you,
Sean
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I did it by passing the session id in as an applet parameter from the jsp:plugin page.

JSP:


Applet:


In the class that the applet uses to make the HTTP Post:

[ June 15, 2005: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Sean McGarvey
Greenhorn

Joined: Jun 15, 2005
Posts: 9
Ben,

Thank you for the suggestion. I believe that I am already doing exactly what you suggested though.

I did notice that when I try to access the web application running the client through IE directly on the web server, everything works fine. However, when I try to access from another host, I am getting an IE privacy report stating that the cookie was blocked. Also, I notice that the parameter "jsessionid=###" is in the url query. I have tried this from different hosts and am sure that the privacy settings on each host are setup to allow all cookies.

I think that my problem must have something to do with how I have setup Apache and JBoss on my web server. Are you aware of any server settings that I might need to modify?

Thank you,
Sean
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

In my code, I'm not using the cookie stored in the browser. I'm setting an applet init param with the value of the session ID. I then manually add the jsessionid to the request headers when I post from the applet to the servlet.

I am not aware of any Apache or JBoss settings.
Do you have cookies disabled in your browser?
 
 
subject: send session from applet to servlet