tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: partial URLPatternMatching in Tomcat 4.0 (Servlet 2.3 spec)?
Date Sat, 04 Aug 2001 02:08:00 GMT


On Thu, 2 Aug 2001, Ru, Simon wrote:

> I wonder if Servlet 2.3's Filter allow partial URLPatternMatching. Something
> like:
> 
> <filter-mapping> 
> <filter-name>timerFilter</filter-name> 
> <url-pattern>/Controller?action=timer*</url-pattern> 
> </filter-mapping> 
> If it can, then we can use the Filtering mechanism as a controller to do
> request dispatching. We can avoid having thousands if statements in the
> Controller and we can easily modify the dispatching route without recompile.
> 
> If it can't, is it something worth enhancing? What needs to add to have that
> capability? Thanks in advance. 
> 

While what you propose might be quite nice, Tomcat needs to conform to the
servlet spec's rules for what a legal <url-pattern> can contain -- it's
the same for both filter mappings and servlet mappings -- and this pattern
is not legal.

One strategy would be to match for "/Controller/*" and let the filter look
at the query parameters to decide whether or not to do anything
special.  Otherwise, it can just pass the request on unmolested.

> Simon Ru
> Software Engineer
> (510) 897-5331
> http://www.worldchain.com
> 

Craig McClanahan


Mime
View raw message