You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by dshah <di...@exit41.com> on 2009/12/16 05:08:00 UTC

Cache Control in click

Hi,
I wanted to clarify something - on reading some documentation and reading
some examples http://incubator.apache.org/click/docs/click-dtd-example.html
- it seems that by default Click uses no-cache control.. I am wondering,
what would happen (is it wrong) to use caching?  

Currently, we specify the following in our html page:
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
      .....
</head>

I am wondering if we remove the line with CACHE-CONTROL, would click behave
differently?

Thanks!
Dipita
-- 
View this message in context: http://n2.nabble.com/Cache-Control-in-click-tp4173760p4173760.html
Sent from the click-user mailing list archive at Nabble.com.

Re: Cache Control in click

Posted by Bob Schellink <sa...@gmail.com>.
Hi Dipita,

dshah wrote:

> Currently, we specify the following in our html page:
> <head>
> 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> 	<meta HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
>       .....
> </head>
> 
> I am wondering if we remove the line with CACHE-CONTROL, would click behave
> differently?


Nope, you can tune the meta tags and HTTP headers to your liking. This will influence the behavior 
of the browser, not Click.

Keep in mind that the browsers cache behavior is controlled by both <meta> tags and HTTP headers and 
HTTP headers normally overrides <meta> tags.

You can either tune the HTTP headers globally for all pages in your click.xml or on a per Page basis 
through the setHeader/setHeaders/getHeaders methods:

public class MyPage extends Page {

   public void onInit() {
     // remove all preconfigured headers
     getHeaders().clear();
   }
}

kind regards

bob