Using regular expressions for filter-mapping

DanC picture DanC · Jun 4, 2012 · Viewed 7k times · Source

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/.+/*

Answer

BalusC picture BalusC · Jun 5, 2012

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.