You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by li...@apache.org on 2008/03/19 01:02:32 UTC
svn commit: r638646 -
/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpUtil.java
Author: lindner
Date: Tue Mar 18 17:02:31 2008
New Revision: 638646
URL: http://svn.apache.org/viewvc?rev=638646&view=rev
Log:
Set correct cache-control headers with TTL=0
Modified:
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpUtil.java
Modified: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpUtil.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpUtil.java?rev=638646&r1=638645&r2=638646&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpUtil.java (original)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpUtil.java Tue Mar 18 17:02:31 2008
@@ -47,7 +47,7 @@
}
/**
- * Sets HTTP headers that instruct the browser to cache indefinitely.
+ * Sets HTTP headers that instruct the browser to cache content.
* Implementations should take care to use cache-busting techniques on the
* url.
*
@@ -59,12 +59,17 @@
response.setDateHeader("Expires",
System.currentTimeMillis() + (1000L * ttl));
- // IE seems to need this (10 years should be enough).
- response.setHeader("Cache-Control", "public,max-age=" +
- Integer.toString(ttl));
-
+ if (ttl == 0) {
+ response.setHeader("Pragma", "no-cache");
+ response.setHeader("Cache-Control", "no-cache");
+ } else {
+ // IE seems to need this (10 years should be enough).
+ response.setHeader("Cache-Control", "public,max-age=" +
+ Integer.toString(ttl));
+ }
// Firefox requires this for certain cases.
response.setDateHeader("Last-Modified", START_TIME);
+
}
/**