tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Crowther" <Peter.Crowt...@melandra.com>
Subject RE: What is allowed to do with a HttpServletRequest ?
Date Thu, 14 Jul 2005 15:22:51 GMT
> From: cristi [mailto:cristi@medialab.sissa.it] 
> I have a web application where I need to use in a second request the
> HttpServletRequest object sent to the same servelet in the first
> request.
[...]
> 	session.setAttribute( "FIRST_REQUEST_OBJECT", request );

Unsafe.  Servlet containers may re-use request objects between
invocations.  Can't remember for sure, but I think Tomcat does so.  So
your second request object may be identical to your first request
object.

> It seems that it is not safe to do so. What can I do to 
> handle this situation ?

As Guillaume said: copy the state you need from the first request into
the session, rather than storing the entire request.

		- Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message