How does one redirect a session on one web server (computer A) to another
web server (computer B) and retain all of the session information, like a
Bean that has been instantiated (on computer A) and has session scope, etc.
Printable View
How does one redirect a session on one web server (computer A) to another
web server (computer B) and retain all of the session information, like a
Bean that has been instantiated (on computer A) and has session scope, etc.
In article <399a9797$1@news.devx.com>,
Carl Crosswhite <Carlxw@ix.netcom.com> wrote:
>
>How does one redirect a session on one web server (computer A) to another
>web server (computer B) and retain all of the session information, like a
>Bean that has been instantiated (on computer A) and has session scope, etc.
There's nothing in the JSP specification that allows for this,
unfortunately. However, there are a few ways you could go about it.
If both computers have access to some database, A could store all the
session information into a table before the redirect, and then a
servlet or JSP on B could retrieve the data and use it to rebuild the
session. You would also need to pass some sort of ID in the redirect,
so that B would know which data to retrieve.
Alternately, you might be able to pass all the session information
through the query string when you do the redirect. This would be
pretty easy to implement if everything in the session is simple data
like ints and strings. If you are storing a lot of objects in the
session, this gets messier.
Some application servers may provide functionality behind the base JSP
spec. I think ATG's "Session Federation" allows data to be shared
between applications running on different machines.
- Larne
Yes you can do it with ATG Dynamo. There is also a very good feature that
sends your session data to a second server if the first goes down for any
reason.
Fernando Ribeiro
fribeiro@bol.com.br
larnep@canetoad.canetoad.com (Larne Pekowsky) wrote:
>In article <399a9797$1@news.devx.com>,
>Carl Crosswhite <Carlxw@ix.netcom.com> wrote:
>>
>>How does one redirect a session on one web server (computer A) to another
>>web server (computer B) and retain all of the session information, like
a
>>Bean that has been instantiated (on computer A) and has session scope,
etc.
>
>There's nothing in the JSP specification that allows for this,
>unfortunately. However, there are a few ways you could go about it.
>
>If both computers have access to some database, A could store all the
>session information into a table before the redirect, and then a
>servlet or JSP on B could retrieve the data and use it to rebuild the
>session. You would also need to pass some sort of ID in the redirect,
>so that B would know which data to retrieve.
>
>Alternately, you might be able to pass all the session information
>through the query string when you do the redirect. This would be
>pretty easy to implement if everything in the session is simple data
>like ints and strings. If you are storing a lot of objects in the
>session, this gets messier.
>
>Some application servers may provide functionality behind the base JSP
>spec. I think ATG's "Session Federation" allows data to be shared
>between applications running on different machines.
>
> - Larne
What about serializing the session object and passing it on? [Using sockets,
or using servlets themselves:binay streams?]
In article <399cce92$1@news.devx.com>, Ashutosh Narhari <none@none.com> wrote:
>
>What about serializing the session object and passing it on? [Using sockets,
>or using servlets themselves:binay streams?]
Hmmm, that's clever. You would have to make sure that the session
gets to the second machine before the user does, but that shouldn't be
too hard to arrange. And you would still need some way to attach the
user to the session once they get to the second machine, but all you'd
need here is an ID.
- Larne