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

Default servlet does not work with routing #878

Open
ameet20 opened this issue Feb 2, 2019 · 1 comment
Open

Default servlet does not work with routing #878

ameet20 opened this issue Feb 2, 2019 · 1 comment

Comments

@ameet20
Copy link

ameet20 commented Feb 2, 2019

The default servlet is mapped using / as the url pattern. Per the spec (12.2):

A string containing only the ’/’ character indicates the “default” servlet of the
application. In this case the servlet path is the request URI minus the context path
and the path info is null

This means that if I hit a URL like http://domain.tld/hello, the requestURI is /hello. This is from the servlet path being /hello and the path info being null. This is unlike a servlet mapping of /*, which has an empty servlet path and /hello in the path info.

The end result is that the requestPath is parsed to / when hitting the route matcher, making it impossible to match anything.

It's not entirely clear to me what the best solution to this is. Perhaps one can infer that if path info is null, then the servlet has hit a perfect match, obviating the need for routing. If such routing exists anyway, it must be an error. Not sure if there are edge cases though.

A more brute solution, could be to have an overridable def isDefaultServlet: Boolean = false method.

@takezoe
Copy link
Member

takezoe commented Mar 17, 2019

In short, a problem you describe is that if ScalatraServlet mapped to /, there is no way to call that servlet due to null of the path info, right?

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

No branches or pull requests

2 participants