jakartaee / jakartaee/servlet

Clarify behavior of path mappings

Open
#855 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
325
Forks
112
PR merge metrics
No merged PRs in 30d

Description

In [Section 12.2](https://jakarta.ee/specifications/servlet/6.1/jakarta-servlet-spec-6.1#specification-of-mappings) states that, when defining mappings:

> A string beginning with a "/" character and ending with a "/*" suffix is used for path mapping.

Later in the [Example Mapping Set](https://jakarta.ee/specifications/servlet/6.1/jakarta-servlet-spec-6.1#example-mapping-set), the path mapping `/baz/*` is given for the servlet `servlet2`, and then the following example is given for incoming path matching:

> /baz -> servlet2
> /baz/index.html -> servlet2

This would imply that "/whatever/*" should match "/whatever", but the tests ([1](https://github.com/jakartaee/servlet/blob/master/tck/tck-runtime/src/main/java/servlet/tck/spec/servletmapping/ServletMappingTests.java), [2](https://github.com/jakartaee/servlet/blob/master/tck/tck-runtime/src/main/java/servlet/tck/spec/multifiltermapping/MultiFilterMappingTests.java), [3](https://github.com/jakartaee/servlet/blob/master/tck/tck-runtime/src/main/java/servlet/tck/spec/defaultmapping/DefaultMappingTests.java)) don't have a test for this case, and the Javadoc for [HttpServletMatching](https://jakarta.ee/specifications/servlet/6.1/apidocs/jakarta.servlet/jakarta/servlet/http/httpservletmapping) also doesn't include an example for this case.

I'm pretty confident from some testing that Undertow, for example, doesn't implement it the way the spec document describes it, i.e. for the example in the document with "/baz/*", a request to "/baz" would _not_ be directed to `servlet2`.

Is that how it's supposed to work? If so, should the TCK include tests to make it clear whether an implementation has it right or not?

Contributor guide

Open the contributing guide

Research direction

Start with Section 12.2 and the Example Mapping Set in the Servlet 6.1 specification, then review ServletMappingTests.java, MultiFilterMappingTests.java, DefaultMappingTests.java, and the HttpServletMapping Javadoc. Compare the documented /baz/* behavior with the existing tests and implementation behavior. Done means the expected /baz result is decided and the specification, Javadoc, and TCK coverage are made consistent if changes are required.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
documentation, testing
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.