Author: ssmiweve Date: 2007-10-29 13:29:49 +0100 (Mon, 29 Oct 2007) New Revision: 5852
Modified: branches/2.15/skinresourcefeed/src/main/java/no/sesat/commons/resourcefeed/ResourceServlet.java Log: https://helpdesk.basefarm.com/bin/customer?action=listTicket&ticketId=274212 Modified: branches/2.15/skinresourcefeed/src/main/java/no/sesat/commons/resourcefeed/ResourceServlet.java =================================================================== --- branches/2.15/skinresourcefeed/src/main/java/no/sesat/commons/resourcefeed/ResourceServlet.java 2007-10-28 18:47:47 UTC (rev 5851) +++ branches/2.15/skinresourcefeed/src/main/java/no/sesat/commons/resourcefeed/ResourceServlet.java 2007-10-29 12:29:49 UTC (rev 5852) @@ -27,6 +27,7 @@ import java.util.Map; import java.util.HashSet; import java.util.Arrays; +import java.util.Calendar; /** Resource Provider. * Serves configuration files (properties, xml), css, gifs, jpgs, javascript, @@ -52,6 +53,8 @@ private static final Map<String,String> CONTENT_TYPES = new HashMap<String,String>(); private static final Map<String,String> CONTENT_PATHS = new HashMap<String,String>(); private static final Set<String> RESTRICTED = new HashSet<String>(); + + private static final Calendar CROWNING_OF_HAILE_SELASSIE = Calendar.getInstance(); private long defaultLastModified = 0; private String[] ipaddressesAllowed = new String[]{}; @@ -74,6 +77,11 @@ CONTENT_TYPES.put("html", "text/plain"); CONTENT_TYPES.put("class", "application/java"); CONTENT_TYPES.put("jar", "application/java-archive"); + + // Things that don't expire + CROWNING_OF_HAILE_SELASSIE.set(Calendar.YEAR, 9999); + // call it in a safe environment (internals are not thread safe). + CROWNING_OF_HAILE_SELASSIE.getTimeInMillis(); } /** @@ -258,7 +266,10 @@ // nothing is cached across deployment versions. if(!restricted){ response.setHeader("Cache-Control", "Public"); - response.setDateHeader("Expires", Long.MAX_VALUE); + // We used to use Long.MAX_VALUE but http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + // shows the year field can only be four digits long. + // see https://helpdesk.basefarm.com/bin/customer?action=listTicket&ticketId=274212 + response.setDateHeader("Expires", CROWNING_OF_HAILE_SELASSIE.getTimeInMillis()); } // Avoid writing out the response body if it's a HEAD request or a GET that the browser has cache for _______________________________________________ Kernel-commits mailing list Kernel-commits@sesat.no http://sesat.no/mailman/listinfo/kernel-commits