• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet session sharing

 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to pass the session to my applet.
Can I just put it in the code I use to call the applet?
Like this:


Or is that not safe enough?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The applet has no access to the archive tag; you'll need to use a <param> tag instead so that the applet can read it using the Applet.getParameter method.
 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok

So when I do that i can add "jsessionid=..." to the urls of every servlet I call in the applet atleast for the GET methods.
How can I do this for PostMethod? This is what I have been trying, but it still uses a different session



Or is there a way of changing the session of the applet all together?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Normally applets use the same cookies the browser uses, so the sessionid should be sent automatically without the applet code having to do anything about it. If that's not the case, then the HttpClient documentation leads me to believe that it's necessary to call method.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES) if you want to handle cookies manually.
 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm strange

I can't think of anything I do to change the default behaviour of the applet.

And it still uses another session...

Or could it be that the servlets, I call from the applet use a different session?

 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing to try would be to use a TCP/IP or HTTP monitor and check that the format used by the web pages and the applet for sending the sessionID is actually identical.
 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok

I have made some progress.

It seems that the servlet recieves the jsession cookie from the applet correctly.
But it just ignores it.

Could this have something to do with tomcat?
 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok

I found the solution,

apparently the parameter name should be uppercase.

Although almost every search I did, I came across jsessionid in Lowercase.

Stupid mistake I guess

Thank you for the help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic