Search code examples
tomcatservletsservlet-filtersurl-pattern

tomcat filter url-pattern problem


Hi i have a tomcat server version 5.5.12 and i am using a filter, the problem is that for some files the filter works and for other it doesnt, for example for the path /software/files/generator.7z it works but for path /software/files/tokenizer.7z it doesnt. any idea what is the probelm ? thanks.

here is my filter tags in the web.xml file.

<filter>
  <filter-name>LogFilter</filter-name>
  <filter-class>servlet.filters.LogFilter</filter-class>
  <init-param>
    <param-name>test-param</param-name>
    <param-value>This parameter is for testing.</param-value>
  </init-param>
</filter>
<filter-mapping>
   <filter-name>LogFilter</filter-name>
   <url-pattern>/software/files/*</url-pattern>
</filter-mapping>

Solution

  • It looks fine. Apparently it was been requested from the browser cache instead of straight from the webserver.

    Clean your browser cache, or do Ctrl+F5, or let the server add response headers which instructs the browser to not cache the response.