Status: New
Owner: ----

New issue 584 by steve.skrla: Provider<ServletRequest> does not provide a wrapped servlet request capable of executing RequestDispatcher.include
http://code.google.com/p/google-guice/issues/detail?id=584

I am using Guice 2.0 (Maven artifact) and Tomcat 6.x / 7.x on Ubuntu.

When I try to inject a ServletRequest with a provider (and I suspect even directly), the object provided is not of type ManagedFilterPipeline$2, which I believe is the type provided to the service(HttpServletRequest, HttpServletResponse) methods of guice managed servlets and required for the include and forward methods to work. As a result, the getRequestDispatcher(String) method does not return a dispatcher that is aware of the guice managed servlets and my include calls fail to resolve the appropriate servlets.

example:

Module.class
    serve("/dwr/*").with(DwrServlet.class);

SomeServlet.class
protected void service(HttpServletRequest req, HttpServletResponse resp) {
        // Works as expected
        req.getRequestDispatcher("/dwr/engine.js").include(req, resp);
    }

SomeBrokenUtility.class
    class SomeBrokenUtility {
        @Inject Provider<ServletRequest> requestProvider;

        public String pullFromDwr() {
            FakeHttpResponse resp = ...;

            ServletRequest req = requestProvider.get();

            // Throws a FileNotFoundException as the DefaultServlet cannot
            // locate the requested resource
            req.getRequestDispatcher("/dwr/engine.js").include(req, resp);

            return resp.getResponseAsString();
        }
    }


--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to google-guice-...@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en.

Reply via email to