cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kai Mütz <kmu...@web.de>
Subject RE: Strange response.setHeader behaviour in custom reader (Cocoon 2.1.8)
Date Fri, 24 Mar 2006 09:34:54 GMT
Has anybody observed a similar problem and can help?

Thanks in advance,
Kai

> -----Original Message-----
> From: users-return-86029-kmuetz=web.de@cocoon.apache.org
> [mailto:users-return-86029-kmuetz=web.de@cocoon.apache.org]On Behalf Of
> Kai Mütz
> Sent: Wednesday, March 22, 2006 1:59 PM
> To: users@cocoon.apache.org
> Subject: Strange response.setHeader behaviour in custom reader (Cocoon
> 2.1.8)
>
>
> Hi,
>
> we use a custom reader component similar to ResourceReader which makes use
> of HTTP Headers. In addition to the settings in ResourceReader I want to
> disable client caching by setting the "Cache-Control" header (like
> HTTPCacheAction does). Thus I have extended the seupHeaders() method to:
>
> private void setupHeaders() {
>     Response response = ObjectModelHelper.getResponse(this.objectModel);
>     final long MILLISECONDS_PER_SECOND = 1000L;
>     Calendar calendar = Calendar.getInstance(DateUtils.UTC_TIME_ZONE);
>     String formattedCal = this.formatter.format(calendar);
>     if (this.expires > MILLISECONDS_PER_SECOND) {
>         calendar.setTimeInMillis(calendar.getTimeInMillis() +
> this.expires);
>         response.setHeader("Expires", this.formatter.format(calendar));
>         response.setHeader("Cache-Control", "max-age="
>                 + Long.toString(this.expires / MILLISECONDS_PER_SECOND));
>     } else if (0 <= this.expires) {
>         response.setHeader("Expires", formattedCal);
>         response.setHeader("Cache-Control", "max-age=0");
>     } else if (this.expires == -1) {
>         response.setHeader("Expires", "Thu, 01 Jan 2000 00:00:00 GMT");
>         response.setHeader("Cache-Control", "no-cache");
>         response.setHeader("Pragma", "no-cache");
>     }
> }
>
> The first two "ifs" are working correctly. But in case of disabled cache
> (expires == -1) the "Expires" and "Cache-Control" headers are
> either not set
> or overwritten elsewhere. The "Pragma" header ist set correctly! This is
> very strange for me. Any ideas?
>
> Thanks,
> Kai
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message