I know I cannot use regular expressions for the url-pattern of a filter-mapping, but I wanted to know if it is possible somehow to map the filter using something like /foo/.+/*
Asked
Active
Viewed 7,381 times
3

DanC
- 8,595
- 9
- 42
- 64
2 Answers
3
No. As to wildcard matching, the <url-pattern>
only supports prefix (/folder/*
) or suffix (*.extension
) matching.
If you want more finer grained matching like as possible with Apache HTTPD's mod_rewrite
, then use Tuckey's UrlRewriteFilter or OCPSoft Rewrite instead. They support mod_rewrite
-like expressions by XML configuration.

BalusC
- 1,082,665
- 372
- 3,610
- 3,555
2
No. URL Patterns in Servlet does not support regular expressions. They can be only of these below three types:
Exact Pattern
For Ex,/folder/abc.html
,/folder/abc
Directory Pattern
For Ex,/folder/abc/*
Extension Pattern
For Ex,*.js
,*.reports
etc

Ramesh PVK
- 15,200
- 2
- 46
- 50