If you use HTTP you can get servlets to track sessions for you using cookies
(normally) or URL re-writing. However in your case this won't help unless
you write the Applet to understand cookies (typically it's the browser doing
the HTTP and it understands cookies fine).
Remember all cookies are is some piece of state that's passed between client
and server in a disconnected environment, that allows the server to
identifiy the client the next time te client connects. The 'cookie' is
initially generated by the server and then stored somewhere (memory/disk) by
the client for a period of time. Given this it is easy to implement your own
version of cookies using applets/servlets.
Get the servlet to generate a sessionid that it passes to the applet in its
first response, the applet stores this away and passes it back to the
servlet on each subsequent request. Problems I see however is that applets
can persist away their state (i.e. can't write to the hard disk), and many
browesers now destroy applets whenever the user browses away from the page
the applet is on, so the applet looses its in-memory state as well, although
you may be able to fix the second problem by having the servlet that
generates the HTML page place the sessionid as an applet PARAM tag,
Kevin Jones
DevelopMentor
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> Monica Ferrero
> Sent: 21 January 2000 13:58
> To: [EMAIL PROTECTED]
> Subject: Session tracking in applet-servlet communication & problems
> with Java Web Server
>
>
> Hi everyone!
>
> I'm quite new in Java and servlets so I'm sorry if my
> question is too silly.
>
> I'm developing an application where an applet
> communicates with a servlet using sockets (following
> the schema in the book JAVA Servlet Programming
> (O'really), chapter 10).
> I'm using the Java Web Server 2.0 and JSDK 2.0.
>
> I wanted to implement session tracking but as far as I
> know it's necessary a communication using the HTTP
> protocol. Is that true?? Can I do it with my
> socket-based communication??
> You should know that in my implementation the servlet
> doesn't have even a doGet or doPost function.
>
>
> And another question. I have my servlet loaded in the
> JWS at startup and anytime I modify the servlet and I
> want to change the class files of the servlet I have
> problems even if I unload/load the servlet or start
> again the JWS. It seems like the port I use is being
> used by the former servlet. Any ideas??
>
> Thanks a lot
>
> Monica
>
>
>
> Tu correo gratis en MixMail http://www.mixmail.com
> Inicia tu navegacion en http://www.ya.com
>
> __________________________________________________________________
> _________
> 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
___________________________________________________________________________
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