Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Servlet mapping does not match base on SUFFIX style #741

Open
gissuebot opened this issue Jul 7, 2014 · 1 comment
Open

Servlet mapping does not match base on SUFFIX style #741

gissuebot opened this issue Jul 7, 2014 · 1 comment
Labels

Comments

@gissuebot
Copy link

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

@anuragagarwal561994
Copy link

Do we have any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants