tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <>
Subject Re: Web resource By-pass
Date Fri, 05 Feb 2010 15:17:51 GMT
On 05/02/2010 14:59, Mihalakakos, Demetri wrote:
> Hi,
> I have a question about the best way of doing something.
> I'm writing an application where all requests would get routed to a Filter (mapping:
"/*").  So when I get a requests like "/some/page/in/the/web/" (which does not actually live
in the file system) I would forward to a Servlet or handle appropriately.  The problem is
all web resources are being routed there as well (js, css, images), is it possible to have
all files and folders that do exist on the file system get served normally and not through
my Filter.  I know I can do a simple io check in the filter, but I was wondering if that's
actually the best/only way (one of my concerns is optimization)

1. You could immediately pass through those requests by doing something 

  if (matchesStaticFiles(hreq.getRequestURI())) {
      chain.doFilter(hreq, hres);

2. Or put them in a separate application and refer to them with an 
absolute URL.


> For example in PHP or Python I would put something like this in the vhost: (which is
technically happening out side the application)
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^(.*)$ /index.php [L]
> Also I prefer not use 'Apache httpd' with 'tomcat'
> Thank you
> Demetri

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message