On 15 June 2011 18:54, Konstantin Kolinko <[email protected]> wrote:
> The request and response objects must never be accessed outside the
> request processing cycle. The objects are recycled and cleared or
> reused for subsequent request and responses, and are not guaranteed to
> be thread-safe. The consequences can be severe.
I was interested by this.
So:
private Service service;
@Override
public void init() throws ServletException {
super.init();
service = (Service)
WebApplicationContextUtils.getWebApplicationContext(getServletContext()).getBean("service");
}
protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
service.logHit(request);
....
}
is a bad thing?
Could you explain why?
I would assume that a new request object is created each time, and
that while something has a reference to it, it will be fine, and when
logHit has finished with it, it will be eligible for garbage
collection.
Calum
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]