-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
From google.com@cefn.com on December 14, 2010 14:37:28
I am forwarding from one servlet to another which triggers an exception in Guice code.
The request comes in as http://localhost:8080/about which is forwarded to the FreemarkerServlet by
request.getRequestDispatcher("/about.tpl").forward(request, response);
...the pathInfo logic gets confused and tries to retrieve a large section of a zero-length string.
Can anyone tell me how I'm supposed to forward requests as this is definitely broken? Perhaps it's the servlet engine which is broken, but the error turns up in Guice.
Copy-pasting the stack information from a live eclipse debugging session gives you these values...
String "getServletPath()"= "/about.test"
String "getRequestURI()"= "/about.ftl"
String "getContextPath()"= ""
...so clearly the following code in ServletDefinition will throw an array out of bounds.
final int servletPathLength = getServletPath().length();
pathInfo = getRequestURI().substring(getContextPath().length()).replaceAll("[/]{2,}", "/").substring(servletPathLength);
The project is organised as a maven project, managed in eclipse, and is downloadable from github if more information about configuration is needed. Servlet config is mostly in this directory... https://github.com/cefn/Spring-JPA-MVC-Postgres/tree/1407d2d000aa2f9e964f23406a3aee355de14c00/src/main/java/com/cefn/filesystem/servlet I'm hosting GuiceServlets 3.0-20100927 from the maven groupid com.mycila.com.google.inject.extensions on Jetty 8.0.0M2.
Original issue: http://code.google.com/p/google-guice/issues/detail?id=580