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
The javadoc for HttpServletMapping.getMatchValue() says
If the getMappingMatch value is CONTEXT_ROOT or DEFAULT, this method must return the empty string. If the getMappingMatch value is EXACT, this method must return the portion of the path that matched the servlet, omitting any leading slash. If the getMappingMatch value is EXTENSION or PATH, this method must return the value that matched the '*'.
It says the leading slash should be omitted for EXACT matches, but it does not say that for EXTENSION or PATH. So if we had an EXTENSION mapping *.ts and had a request at /a.ts, then the javadoc seems to indicate that the leading slash should be included as it matched the '*'.
There is TCK test com/sun/ts/tests/servlet/api/javax_servlet_http/httpservletrequest40/Client.java#httpServletMappingTest2 which tests that the leading slash was not included and we get a matchValue of just a.
If the TCK has the correct behaviour I think the javadoc should be more clear about when the leading slash is omitted for matchValue.
The text was updated successfully, but these errors were encountered:
Good point. There's a table in the javadoc that clearly doesn't show the leading slash, but this should be in the javadoc as well. Let's clarify this for Servlet 6.0.
markt-asf
added a commit
to markt-asf/servlet-api
that referenced
this issue
Jan 20, 2023
The javadoc for
HttpServletMapping.getMatchValue()
saysIt says the leading slash should be omitted for
EXACT
matches, but it does not say that forEXTENSION
orPATH
. So if we had anEXTENSION
mapping*.ts
and had a request at/a.ts
, then the javadoc seems to indicate that the leading slash should be included as it matched the'*'
.There is TCK test
com/sun/ts/tests/servlet/api/javax_servlet_http/httpservletrequest40/Client.java#httpServletMappingTest2
which tests that the leading slash was not included and we get a matchValue of justa
.If the TCK has the correct behaviour I think the javadoc should be more clear about when the leading slash is omitted for matchValue.
The text was updated successfully, but these errors were encountered: