HttpServletRequest is scoped per-thread.
The object that is injected is a proxy around the actual HttpServletRequest object. When you reference it, the methods are called on the "real" request for the current thread.

So, yes, it works. :)

You can do the same thing with the hibernate Session object if you're using the tapestry-hibernate module. You'll get a per-thread session automagically.

Robert

On Apr 10, 2009, at 4/1012:21 AM , daniel joyce wrote:

public MyRequestFilter implements RequestFilter {

   private final HttpServletRequest servletRequest;

   public MyRequestFilter(HttpServletRequest request) {
       servletRequest = request;
   }

   public boolean service(Request request, Response response,
RequestHandler handler)
   {
        //do stuff with the servlet request.
        return handler.service(request,response);
   }
}

If RequestFilter is a singleton, wouldn't this simply not work? Since
HttpServletRequest is essentially per-thread? And we are only set it
once when the filter is built? But if scoped as per-thread, would it
work then?

-Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to