Any way of mapping java servlet using simple regex?

Viewed 864

I need to map /Test to a servlet Test.java and also /anything/Test to the same servlet. I read that /*/Test won't work in web.xml as it doesn't accept regex.

Is there any alternate way of doing it using filters ? I can't use Tuckey URL filter due to some blockage issue. Also, I need that "anything" also in my servlet. I planned to process the url string for that if I am able to map.

For example

/ProjectName/Test Should open Test servlet

and also /ProjectName/xyz/Test Should also open Test servlet

Now xyz can be anything. And I also want to get xyz in my Test servlet. I planned to get xyz in by request.getRequestURI() and fetching it from the url.

1 Answers
Related