Based on Java Servlet Specification Version 3.0:
In the Web application deployment descriptor, the following syntax is used to define mappings:
A string beginning with a ‘/’ character and ending with ‘/*’ suffix is used for path mapping.
A string beginning with ‘*.’ prefix is used as an extension mapping.
A string containing only the ‘/’ character indicates the “default” servlet of the application.
All other strings are used for exact matches only.
so, I have next questions:
-
How I can process this URL pattern: “/foo/bar/*.jsp”?
-
What principal difference between ‘/*’ and ‘/’?
Use less restrictive pattern (for example,
/foo/bar/*) and apply additional restrictions programmatically./handles request only if its URL doesn’t match any other mapping, whereas/*follows normal mapping precendence rules.For example, if you map front controller of your application as
/*you won’t be able to render JSP pages, because/*takes precendence over built-in JSP servlet mapped to*.jsp.