Status: New
Owner: ----

New issue 741 by [email protected]: Servlet mapping does not match base on SUFFIX style
http://code.google.com/p/google-guice/issues/detail?id=741

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.

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to