Custom headers

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 +0. To indicate the current date plus 20 days, 10 hours, 30 minutes, and 20 seconds, set value to +20D10H30M20S.

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: b222308-205-e28daea590.

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

For more information on filters and programming customized responses, see the Java Web page.