Mike Fontenot <[EMAIL PROTECTED]> wrote:
MF> I think, even though your servlet engine is the
MF> same, it is attached to different web MF>
servers(HTTP/HTTPS). This results in two different MF>
sessions being created.
That's correct. Since HTTP and HTTPS URIs are
different, they map to different servlet contexts and
different HTTP session IDs.
MF> One way is to pass the session id from one server
MF> to the other on the URL, once you do that then you
MF> can get the actual HttpSession MF> instance. Then
MF> copy the values from one session into another
[...]
Correct but only for 2.0 servlet spec.
HttpSessionContext interface has been deprecated as a
whole in 2.1. You can no longer ask a servlet engine
for a session by a session ID.
In 2.1 or later, you have two choices if you want to
do this. The first choice assumes that you're running
in a single VM and your sessions stay in memory. Then,
you can resurrect HttpSessionContext by creating a
class that keeps track of HttpSession instances by ID.
Your class can even implement 2.0 HttpSessionContext
interface for clarity. (You'll need to create the
class for the interface too). The same instance of
this class will have to be available to all servlets;
this can be easily implemented as a singleton. When a
session has been successfully created, send a message
to your singleton instance. The rest follows :>
If you're not running in a single VM or your sessions
are persisted to disk or database, you can't use the
approach above. In this case, your application needs
to be explicitly designed for HTTP/HTTPS session
affinity. The path of least resistance in this case is
to restore the state (your session contents) from the
well-known point (database, file, session manager
somewhere), stuff it into your new session and go from
there. Your business logic has to be careful with
assumptions of continuity. Last but not least: if
you're running in a distributed environment with
sticky load-balancing, you can use the first approach.
See the thread at
news://www4.weblogic.com/37E258F8.2805D8FF%40yahoo.com
for more info.
Hope this helps,
Alex.
=====
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.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