Last-Modified filter ver. 1.3


This is a Java servlet filter (as per Servlet API 2.3). This filter lets you add Last-Modified header to the response. So you can force browser send next time If-Modified-Since header and use that information in your cache solutions. See also If-Modified filter.

How to use it:

a) download lastmodflt.jar and save it in WEB-INF/lib

b) describe this filter in web.xml.
 


<filter>
  <filter-name>LastModFilter</filter-name>
  <filter-class>com.cj.response.LastModFilter</filter-class>
</filter>

d) describe a mapping for this filter in web.xml. E.g.:
 


<filter-mapping>
  <filter-name>LastModFilter</filter-name>
  <url-pattern>/a/*.jsp</url-pattern>
</filter-mapping>

in this example filter will be on for the each .jsp file in /a subdirectory. It means that for files from this directory response will provide Last-Modified header.

Also you may exclude some of your files from the processing. Parameter exclude contains a commas separated list of files excluded from the processing. E.g.:
 


<filter>
  <filter-name>LastModFilter</filter-name>
  <filter-class>com.cj.response.LastModFilter</filter-class>
  <init-param>
    <param-name>exclude</param-name>
    <param-value>/main.htm</param-value>
  </init-param>
</filter>

   For downloading:

    Last-modified package:  lastmodflt.jar
 

 ©  Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

Also in JSOS: