Comment by [email protected]:
I've joined the Google Group and submitted the same question twice, yet it
never appeared.
On both occasions I was told it had entered a moderation queue, and it's
dropped into a black hole. No reply, no posting, no nothing.
From: Cefn
Date: 6 December 2010 14:06
Subject: Forwarding to another bound servlet by path [Repeat post - didn't
appear in group]
To: google-guice <[email protected]>
Have a simple test configuration to experiment with guice-servlet at
present, but can't figure how to get one Servlet to direct a request
to another using getRequestDispatcher to draw on the internal path
logic I've configured with Guice.
My HelloWorldServlet gets triggered perfectly well, obligingly
printing 'Hello World' at http://localhost:8080/hello as expected from
the binding below.
protected Injector getInjector() {
return Guice.createInjector(new ServletModule()
{
protected void configureServlets() {
bind(IndexServlet.class).in(Singleton.class);
serve("/").with(IndexServlet.class);
bind(HelloWorldServlet.class).in(Singleton.class);
serve("/
hello").with(HelloWorldServlet.class);
}
});
}
The IndexServlet attempts to do a simple handoff (which I believe
should load my HelloWorldServlet)...
public class IndexServlet extends HttpServlet{
protected void service(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
ServletContext context = getServletContext();
RequestDispatcher dispatcher =
context.getRequestDispatcher("/
hello");
dispatcher.forward(request, response);
}
}
At present all requests to the server root / which tries to forward
the request to HelloWorldServlet terminate as follows...
HTTP ERROR 404
Problem accessing /hello. Reason:
NOT_FOUND
Powered by Jetty://
Any ideas what's wrong with my mental model here.
For more information:
http://code.google.com/p/google-guice/wiki/GuiceDiscussions
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en.