You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the issue: Steps to reproduce: 1. Bind a servlet to a path with serve("/myservlet/*").with(MyServlet.class) that handles GETs.
2. Send a GET request to the server at the path /myservlet.
3. The bound servlet definition with Guice will not match the path in the request due to the way that the ServletStyleUriPatternMatcher creates its pattern.
From ben.andrea on February 08, 2013 13:24:00
Description of the issue: Steps to reproduce: 1. Bind a servlet to a path with serve("/myservlet/*").with(MyServlet.class) that handles GETs.
2. Send a GET request to the server at the path /myservlet.
3. The bound servlet definition with Guice will not match the path in the request due to the way that the ServletStyleUriPatternMatcher creates its pattern.
A change like this is one possible solution:
public ServletStyleUriPatternMatcher(String pattern) {
if (pattern.startsWith("")) {
this.pattern = pattern.substring(1);
this.patternKind = Kind.PREFIX;
} else if (pattern.endsWith("/")) {
this.pattern = pattern.substring(0, pattern.length() - 2);
this.patternKind = Kind.SUFFIX;
} else {
this.pattern = pattern;
this.patternKind = Kind.LITERAL;
}
}
The SUFFIX style will correctly match both '/myservlet' and '/myservlet/something' paths which matches the servlet specification in section SRV.11.2.
Original issue: http://code.google.com/p/google-guice/issues/detail?id=741
The text was updated successfully, but these errors were encountered: