I made a quick modification on my own HttpUtils to correct the year 
problem for now. I see that this class is being deprecated for 2.3 anyway.

For mozilla 1.5 to be happy I read through their web standards on page 
expiration to determine what is deemed to be correct expiration headers 
and found the following code to work (DateManip is my own date class)
hopefully it works as well in IE although I'm not sure how to determine 
that exactly...


        doPostBuildTemplate( Rundata data, Context context )
        {
                // expire in 60 seconds
                DateManip dm = new DateManip();
                dm.addMinutes( 1 );

                // Pragma is considered an invalid header according to RFC 2616
                // data.getResponse().setHeader("Pragma", "no-cache");

                data.getResponse().setHeader("Last-modified", 
HttpUtils.formatHttpDate( new Date() ) );
                data.getResponse().setHeader("Expires", HttpUtils.formatHttpDate( 
dm.getDate() ) );
                data.getResponse().setHeader("Cache-Control", "private,max-age=60");
        }

aparently mozilla does some computation on the last-modified header and 
max-age to determine a valid expiration. expires is supposed to work on 
it's own but it seemed to not want to work for me. max-age value is in 
seconds.

hope this helps anyone else looking for some cache control :)

        Regards,

        Jeff Painter



On Wed, 12 Nov 2003, Jeff Painter wrote:

> 
> I think I found a problem with HttpUtils in 
> 
>       org.apache.turbine.util.HttpUtils
> 
> [Wed Nov 12 14:27:30 EST 2003] -- DEBUG --  DateManip: Mon Nov 10 14:27:30 EST 2003
> [Wed Nov 12 14:27:30 EST 2003] -- DEBUG --  HttpUtils: Mon, 10 Nov 02003 19:27:30 GMT
> 
> it looked like it was placing an extra zero in front of my year and 
> looking at the code in cvs it looks like they httpDateFormat has an extra 
> "y" in the year portion that is causing me my troubles.
> 
> if someone can fix this in cvs that would be cool :)
> 
> 
> public class HttpUtils
> {
>     /**
>      * The date format to use for HTTP Dates.
>      */
>     private static SimpleDateFormat httpDateFormat;
> 
>     static
>     {
>         httpDateFormat = new SimpleDateFormat(
>                 "EEE, dd MMM yyyyy HH:mm:ss z", Locale.US);
>                            ^^^^^ -> 5 digit year?
> 
>         httpDateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
>     }



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

Reply via email to