To add custom response headers for static resources, EAServer provides the filter class com.sybase.jaguar.servlet.AddHeadersFilter. The filter is designed to add cache-related and simple name/string header information to a response. The initialization parameters that you pass to the filter must be in this format:
(name=header_name, value=type:value_type&val:value)
where header_name is the title of the header, and value_type and value can be:
Value type |
Description |
Sample value |
---|---|---|
String |
A text string. |
“Add this to the header.” |
Date |
GMT date specified as, [+|-] ddDhhHmmMssS. |
To indicate the current date, set value to |
Etag |
EAServer generates an entity tag (etag) based on the file’s length, last modified time, and the sum of the file. |
value can be either “E” or “WE”. “WE” specifies a
weak etag. If you set value to “E”,
EAServer writes something like this in the header: |
This example creates an instance of AddHeadersFilter and passes the header name, value type, and value:
com.sybase.jaguar.servlet.filter.init-param= (name=Expires, value=type:date&val:+365D), (name=Cache-Control, type:string&val:max-age=3600)
which adds these two lines to the response:
Expires: Wed, 15 May 2002 15:31:22 GMT Cache-Control: max-age=3600
For more information on filters and programming customized responses, see the Java Web page.
Copyright © 2005. Sybase Inc. All rights reserved. |