----- Original Message -----
From: Raj Singh <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 15, 1999 7:24 AM
Subject: servlet-applet session in Netscape Nav. 4.6


> I've run into an weird problem. I'm trying to maintain a session
> between a client applet and a server servlet. I've tested 3 situations
> and 2 work:
>
> 1. GET request from net. nav. 4.6 HTML to servlet
> 2. GET request from applet running in IE5 to servlet
> 3. GET request from applet running in net. nav 4.6 to servlet
>
> in cases 1 and 2, the servlet maintains 1 session ID for
> all requests from the client. In case 3, a new session ID is
> created for EACH request from the client.
>
> Here are the exciting questions...
> 1. Is this a bug in net. nav. or is IE cheating by passing an
> ID back and forth without my knowledge.
> 2. How is IE passing this ID back and forth when I'm creating the
> URL in the applet with the new URL() constructor--how does the
> browser change my request?

I would assume that the IE applet also allows the browser cookies
to be passed in the URL which does make sense as you would want your
applet to act as it was an extension of the browser (which it in effect is).

What I suspect Netscape Navigator is doing is not making the browser
cookies available to you as in theory the Java Sandbox should allow no
access to the client machine, including the cookies. This is more likely
an over stringent application of the security features applied to applets.

Solution, check to see if the applet
request.isRequestedSessionIdFromCookie()
returns false, if it does then you can pass the session id back to the
applet so that
it can add the id onto any further requests as a get parameter eg
sessionid=<id>.

I do this with other, non browser based, clients and it works ok.

Andy Bailey

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to