You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Hensley, Richard" <Ri...@McKesson.com> on 2004/12/17 01:52:45 UTC

Controlling Page Caching

I'm trying to ensure that no caching of my web pages occurs. I've done the
following, but I don't think this is right because I can't seem to verify it
through inspection of the html. Did I miss something, and this is working
correctly. If it is, how would I verify correct behavior? If I did it wrong,
does anybody have any suggestions?

    public void pageBeginRender(PageEvent event) {
        if (event.getRequestCycle().isRewinding()) {
            return;
        }
        HttpServletResponse res =
event.getRequestCycle().getRequestContext()
                .getResponse();
        res.setHeader("Pragma", "no-cache");
        res.setHeader("Cache-Control", "no-cache");
        res.setHeader("Expires", "-1");
    }

Richard


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Controlling Page Caching

Posted by Michael Echerer <me...@tngtech.com>.
You could also try the LiveHTTPHeaders 1.0 plugin for Mozilla/Firebird 
to check what response your browser receives. Beware of (transparent) 
proxies somewhere in your network that might modify headers, even if 
your own server doesn't send any or different ones.

By the way, I would put the code for setting the http headers in a 
custom engine subclass (there's a method that prepares the request cycle 
etc.) instead of a page (at least if you want to do it for every resource).

Cheers,
Michael

Greg Lappen wrote:
> I have used the tcp monitor from Axis many times to debug things like this:
> 
> http://ws.apache.org/axis/java/user-guide.html#tcpmon
> 
> You configure it as a proxy and and point your browser at it even if 
> your app requires the correct hostname.
> 
> You can download axis from that same URL.
> 
> Greg
> On Dec 16, 2004, at 7:52 PM, Hensley, Richard wrote:
> 
>> I'm trying to ensure that no caching of my web pages occurs. I've done 
>> the
>> following, but I don't think this is right because I can't seem to 
>> verify it
>> through inspection of the html. Did I miss something, and this is working
>> correctly. If it is, how would I verify correct behavior? If I did it 
>> wrong,
>> does anybody have any suggestions?
>>
>>     public void pageBeginRender(PageEvent event) {
>>         if (event.getRequestCycle().isRewinding()) {
>>             return;
>>         }
>>         HttpServletResponse res =
>> event.getRequestCycle().getRequestContext()
>>                 .getResponse();
>>         res.setHeader("Pragma", "no-cache");
>>         res.setHeader("Cache-Control", "no-cache");
>>         res.setHeader("Expires", "-1");
>>     }
>>
>> Richard
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Controlling Page Caching

Posted by Greg Lappen <gr...@lapcominc.com>.
I have used the tcp monitor from Axis many times to debug things like 
this:

http://ws.apache.org/axis/java/user-guide.html#tcpmon

You configure it as a proxy and and point your browser at it even if 
your app requires the correct hostname.

You can download axis from that same URL.

Greg
On Dec 16, 2004, at 7:52 PM, Hensley, Richard wrote:

> I'm trying to ensure that no caching of my web pages occurs. I've done 
> the
> following, but I don't think this is right because I can't seem to 
> verify it
> through inspection of the html. Did I miss something, and this is 
> working
> correctly. If it is, how would I verify correct behavior? If I did it 
> wrong,
> does anybody have any suggestions?
>
>     public void pageBeginRender(PageEvent event) {
>         if (event.getRequestCycle().isRewinding()) {
>             return;
>         }
>         HttpServletResponse res =
> event.getRequestCycle().getRequestContext()
>                 .getResponse();
>         res.setHeader("Pragma", "no-cache");
>         res.setHeader("Cache-Control", "no-cache");
>         res.setHeader("Expires", "-1");
>     }
>
> Richard
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org