Java – can regular expressions be used for jetty’s servlet mapping?
•
Java
I have this mapping
<servlet-mapping> <servlet-name>service</servlet-name> <url-pattern>/service/*</url-pattern> </servlet-mapping>
But I also want / service / master mapping to the master servlet
<servlet-mapping> <servlet-name>master</servlet-name> <url-pattern>/service/master</url-pattern> </servlet-mapping>
I believe there is a conflict here because calling / service / * will immediately trigger the service servlet Is there any way for me to use some kind of exclusion in servlet mapping, or can I use regexp to do what I want to do?
Solution
Servlet mapping always uses the most specific matching, so the path < context > / service / master will always be mapped to the master
This is the first mapping rule of servlet 3.0 spec:
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码