xiaodududu / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

Guice Servlet injects a wrong request #566

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Guice wraps HttpServletRequest with a wrapper ManagedFilterPipeline. This 
wrapper is passed to filters and servlets. However this wrapper is not injected 
to objects. The injected request is the servers original HttpServletRequest.

The result is that an injected object cannot do a forward to a Servlet 
configured in guice, since the servers request is unaware of servlets 
configured in guice.

Typical case is a controller forwarding to a template Servlet. Currently if the 
controller is injected by guice, the template Servlet cannot be in guice in 
order to be found. It has to be in web.xml

Expected:
Inject ManagedFilterPipeline wrapper to beans.
Actual:
The injected request is the original server object.

Original issue reported on code.google.com by twl.e...@gmail.com on 29 Oct 2010 at 11:50

GoogleCodeExporter commented 9 years ago
The bug is for Guice 2

Original comment by twl.e...@gmail.com on 29 Oct 2010 at 11:53

GoogleCodeExporter commented 9 years ago

Original comment by sberlin on 22 Feb 2011 at 1:44

GoogleCodeExporter commented 9 years ago
Perhaps relatedly, the HttpServletRequest object that is injected into objects, 
and the one that is passed to the servlet, return different values for 
getPathInfo().

This is still true as of Guice 3.0-rc3 (the latest version I could find in 
Maven).

Original comment by punya.bi...@gmail.com on 28 Mar 2011 at 12:26

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
We have some filters that wrap HttpServletRequest & Response before calling 
chain.doFilter.  It would be "nice" if the wrappers were injected subsequently. 
 Let me see if I can override the default provider in InternalServletModule...

Original comment by matt.net...@envisagesystems.com on 24 Jun 2011 at 9:13

GoogleCodeExporter commented 9 years ago
Issue 648 has been merged into this issue.

Original comment by sberlin on 27 Sep 2011 at 5:01

GoogleCodeExporter commented 9 years ago
Issue 596 has been merged into this issue.

Original comment by sberlin on 27 Sep 2011 at 5:01

GoogleCodeExporter commented 9 years ago
fixed by r1585, by Isaac.

Original comment by sberlin on 27 Sep 2011 at 5:02