Issue Details (XML | Word | Printable)

Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Rajiv Mordani
Reporter: Santiago Pericas-Geertsen
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

Clarify the path prefix mapping in Section 12.1

Created: 21/Sep/11 01:12 PM   Updated: 06/Feb/13 10:52 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Tags: extension future_release mapping matching path prefix servlet
Participants: gregwilkins, Rajiv Mordani and Santiago Pericas-Geertsen

 Description  « Hide

Section 12.1 states that prefix mapping is done by stepping down the path tree on directory at a time. However, given a path "/foo/", it does not mention how to deal with the trailing "/". This is significant given that "/foo" (no trailing slash) matches "/foo/" as shown later in that chapter (which is a bit confusing if "/" is naively converted in to a regexp).

The use of "/" with the intended semantics is somewhat misleading since it can match any number of paths, including zero. Ant uses "*" to match arbitrary number of directories (including none). IMO, a better syntax for servlet mapping would be:

/.../* => /.../** (path prefix)
(ii) .ext => //.ext (extension mapping)

For example,

(1) match(/a/**, /a/b/c/d) = (/a, /b/c/d)
(2) match(/a/**, /a) = (/a, null) (since ** matches 0 directories)


(3) match(/*/.ext, /a/b/c.ext) = (/a/b/c.ext, null)

Changing the syntax would obviously be backward incompatible, but perhaps an alternate syntax could be consider in future revisions of the spec.

gregwilkins added a comment - 23/Sep/11 04:58 AM

While I agree that the path mapping is a bit strange, I'm loath to change it now.... unless there is significant support to do so.

If there is to be a change in the mapping, then another issue that needs to be fixed is the inability to form a pattern to match the ROOT of a webapp, since "/" is the default mapping. Also the fact that "/" has different semantics to "/*" is confusing as they both match the same requests (in the absence of any suffix matches).

Rajiv Mordani made changes - 06/Dec/11 11:03 PM
Field Original Value New Value
Assignee Rajiv Mordani [ mode ]
Rajiv Mordani made changes - 06/Feb/13 10:52 PM
Tags servlet matching path prefix extension mapping extension future_release mapping matching path prefix servlet