Hey, thanks for the reply.
> I gave it a quick go (trunk build) and it to works with jsp out of the
> box but it is not perfect(calling include works but calling forward
> crashes).
I am just using the snapshot build.
> You're doing req.getRequestDispatcher( "/WEB-INF/jsp/test.jsp"). I
> could be wrong but you are doing the request way your request is
> actually for /<servlet>//WEB-INF/jsp/test.jsp beside I think that
> request for WEB-INF/* should return 404 in any case. WEB-INF is
> private property.
>From my understanding, if I am using the dispatcher from
ServletRequest, forwards and includes will be relative to the servlet
path unless preceded by a slash. In that case, it's relative to
context root, i.e. WebContent. At least this is how it works in
Tomcat and WebSphere.
I tried using the RequestDispatcher from ServletContext without Guice
(straight web.xml mapping) on Tomcat and it looks like it actually
wants all paths to start with a slash, it too serves relative to
context root.
WEB-INF is special in that it can't be access directly from the client
side but you're allowed to access it internally via a request
dispatcher.
> You can try @Inject ServletContext ctx; and doing
> ctx.getRequestDispatcher("/jsp/test.jsp") or properly use request way.
I experimented with getServletContext().getRequestDispatcher() with
the Guice servlet adapter and it too doesn't work with forwards but
it's fine with include. So the request dispatcher doesn't seem to
make a difference and stepping through the debug showed it was the
same problem with the servlet path reported by the server request
wrapper.
> I noticed
>
> serve( "/test" ).with( TestServlet.class );
>
> If you try /test in the browser it will return 404 since the browser
> actually requests /test/ notice the trailing /. Try
>
> serve( "/test/" ).with( TestServlet.class )
I don't think that's the case. When I tried /test in my browser, it
did make a request for /test on the servlet side, sans final slash.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"google-guice" 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?hl=en
-~----------~----~----~----~------~----~------~--~---