I have some doubts in understanding how the value in <url-pattern
> is interpreted to match in either <servlet-mapping>
or <filter-mapping>
. Basically the doubts comes in how *
is interpreted.
Let us assume that I deployed a web-application(.war) with context root /firstweb.
Consider the following <url-pattern>
defined in web.xml
(1) <url-pattern> /* </url-pattern>
(2) <url-pattern> /test/abc </url-pattern>
(3) <url-pattern> /test/abc/* </url-pattern>
(4) <url-pattern> /*/abc </url-pattern>
What I am aware of is that "*"
matches any string / text. With this as basis, I have some doubts.
Q1) For case (1) viz /*
would it match anything? If so, would this match /test
, /text/abc
, /test/abc
etc. when it is in the url?
Q2) Now for case (2) viz /test/abc
would it match when url is exactly /test/abc
? what about /*
because as I believe *
means any text. Won't this make it ambiguous matching pattern?
Q3) Also, I believe all these url are w.r.t to context-root i.e. all urls are like: /firstweb/xxx' ,
/firstweb/test/abc,
/firstweb/`.
Any answers in simple words to clear this doubt is highly appreciated.
Edit
Did some more research, the following links are helpful in understanding the how to interpret <url-pattern>
a) what if url pattern matches multiple servlets?
b) http://docs.roguewave.com/hydraexpress/3.5.0/html/rwsfservletug/4-3.html