You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2010/11/10 17:29:15 UTC

svn commit: r1033570 - /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/WebResource.java

Author: jcompagner
Date: Wed Nov 10 16:29:15 2010
New Revision: 1033570

URL: http://svn.apache.org/viewvc?rev=1033570&view=rev
Log:
backport from 1.5 (if last modified is set in the settings then add public also to the cache control)

Modified:
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/WebResource.java

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/WebResource.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/WebResource.java?rev=1033570&r1=1033569&r2=1033570&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/WebResource.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/WebResource.java Wed Nov 10 16:29:15 2010
@@ -73,7 +73,16 @@ public abstract class WebResource extend
 			// If time is set also set cache headers.
 			response.setDateHeader("Expires", System.currentTimeMillis() +
 				(getCacheDuration() * 1000L));
-			response.setHeader("Cache-Control", "max-age=" + getCacheDuration());
+			if (Application.get()
+				.getResourceSettings()
+				.getAddLastModifiedTimeToResourceReferenceUrl())
+			{
+				response.setHeader("Cache-Control", "public,max-age=" + getCacheDuration());
+			}
+			else
+			{
+				response.setHeader("Cache-Control", "max-age=" + getCacheDuration());
+			}
 		}
 		else
 		{
@@ -87,6 +96,6 @@ public abstract class WebResource extend
 	 */
 	protected int getCacheDuration()
 	{
-		return (int)Application.get().getResourceSettings().getDefaultCacheDuration();
+		return Application.get().getResourceSettings().getDefaultCacheDuration();
 	}
 }