In servlet 3.0 & tomcat 8 , we can get servlet mapping by the servlet name as following:
request.getServletContext().getServletRegistration(servletName).getMappings()
But in tomcat6, getServletRegistration is not exist so how to get the servlet's url mapping by the servlet name?
Since no one reply so I answer my question. I find a way to do that:
Since tomcat6 isn't support dynamic add servlet and annotation for endpoint, so I find a workaround method that direct read the servlet information form web.xml in the listener:
And just get the mapping form context: