|
Hi ,
Instear of rewriting the URL. Before dispatch/
Redirecting the control change the url as given below.
Sring urltoBesent = encodeURL(url);
response.sendRedirect(urltoBesent);
Hope this may help...
Ravisankar.N
----- Original Message -----
Sent: Tuesday, September 24, 2002 11:12
AM
Subject: Re: Session Tracking fails --
always obtaining NEW session?
Dear May,
In the servlet you have to do
session =
request.getSession(false); or request.getSession();
In client you have
to rewrite the URL. It means you have to pass the jsessionid in your
URL. Something like
http://<yourhost>:<port>/file;jsessionid=<jsessionid>?<your
input params>.
For getting the jsessionid you have to add the
following code in the doGet or doPost method of your servlet. This should be
used for only one time.
HttpSession session =
request.getSession(); if(session == null) { session =
request.getSession(true); String id = session.getId();
response.setContentType("text/plain"); PrintWriter pw =
response.getWriter(); pw.println("jsessionId =
"+id); }
The session object is null for the first time. The session
will be maintained for the next time if you pass the jsessionid using the
above procedure.
V.S.Saravanan
May Charles N wrote:
I would like to be able to save a Stateful
Session Bean Handle in an HttpSession. Every time my HttpServlet code (executing in the
Websphere 3.5.3 Test Environment) hits the line:
session = request.getSession(true); it obtains a NEW session rather than an existing one,
even if previous requests have hit the same servlet in the same test.
I've tried this with raw code as a test
client and it fails; then I tried making a JApplet client and running it in
AppletViewer and get the same result. Is it impossible to test session
tracking in the test environment? What am I missing?
Charles May Software Engineer Technology Delivery Department (TDD)
Mellon Financial
Corporation Pittsburgh,
PA
*****************************************************************
DISCLAIMER: The information contained in this e-mail may be
confidential and is intended solely for the use of the named
addressee. Access, copying or re-use of the e-mail or any information
contained therein by any other person is not authorized. If you are
not the intended recipient please notify us immediately by returning the
e-mail to the originator.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of
the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message
"help".
|