Caching static content - Bug in Filter implementation?

2005-07-07 Thread juergen . dufner
Hello

I do some further analysis in this problem and got following result:

Precondition: The filter manipulates the HTTP header when returning a
static resource (e.g. image).

HTTP 200
In case of a HTTP 200 (OK) result the header is not added when the doFilter
method is like following:

filterChain.doFilter(request, response);
response.setHeader(name, value);


In contrast to it works when the code is like following:

response.setHeader(name, value);
filterChain.doFilter(request, response);


In other words: When returning a HTTP 200 (OK) I must set the header before
forwarding the request to the next filter.

HTTP 304
In this case it doesn't mention whether setting the header is before or
after forwarding the request.

Any comments?

Jürgen Dufner


-
Diese E-Mail enthaelt vertrauliche oder rechtlich geschuetzte
Informationen.
Wenn Sie nicht der beabsichtigte Empfaenger sind, informieren Sie bitte
sofort den Absender und loeschen Sie diese E-Mail. Das unbefugte
Kopieren
dieser E-Mail oder die unbefugte Weitergabe der enthaltenen
Informationen
ist nicht gestattet.

The information contained in this message is confidential or protected
by
law. If you are not the intended recipient, please contact the sender
and
delete this message. Any unauthorised copying of this message or 
unauthorised distribution of the information contained herein is
prohibited.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Caching static content

2005-07-06 Thread juergen . dufner
Hello

How to set the HTTP-Header Cache-Control:max-age=3600 in the Response of an
image file?

Here I will describe what I did:

I implemented a  Filter that added the header
  response.setHeader(Cache-Control, max-age=3600);

This works, but not in every case. The first request for an image, that
return HTTP Code 200 (OK) and the image itself, the header is NOT set. The
second or third request for the same image return Code 304 (Not modified),
the header contains Cache-Control:max-age=3600.

Is there a dependency to the HTTP return code? How to supress the second
and third requests?

Regards,
Jürgen Dufner



-
Diese E-Mail enthaelt vertrauliche oder rechtlich geschuetzte
Informationen.
Wenn Sie nicht der beabsichtigte Empfaenger sind, informieren Sie bitte
sofort den Absender und loeschen Sie diese E-Mail. Das unbefugte
Kopieren
dieser E-Mail oder die unbefugte Weitergabe der enthaltenen
Informationen
ist nicht gestattet.

The information contained in this message is confidential or protected
by
law. If you are not the intended recipient, please contact the sender
and
delete this message. Any unauthorised copying of this message or 
unauthorised distribution of the information contained herein is
prohibited.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]