Changeset 353
- Timestamp:
- 08/25/08 12:55:42 (3 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/geowebcache/src/main/java/org/geowebcache/util/ServletUtils.java
r317 r353 34 34 35 35 public class ServletUtils { 36 // Calendar objects are unfortunately expensive and not 37 // thread safe :( 38 static private Calendar calendar = new GregorianCalendar(); 39 static private TimeZone timeZone = TimeZone.getTimeZone("GMT"); 40 static private SimpleDateFormat format = null; 41 42 36 43 /** 37 44 * Case insensitive lookup … … 207 214 208 215 /** 209 * Makes HTTP Expire header vaulue 210 * 216 * Makes HTTP Expire header value 217 * 218 * Has to be synchronized due to the shared Calendar objects 219 * 211 220 * @param seconds 212 221 * @return 213 222 */ 214 public static String makeExpiresHeader(int seconds) {215 SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);216 TimeZone timeZone = TimeZone.getTimeZone("GMT");217 format.setTimeZone(timeZone);218 Calendar calendar = new GregorianCalendar();223 public static synchronized String makeExpiresHeader(int seconds) { 224 if(ServletUtils.format == null) { 225 ServletUtils.format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); 226 ServletUtils.format.setTimeZone(ServletUtils.timeZone); 227 } 219 228 220 229 calendar.setTimeInMillis(System.currentTimeMillis() + seconds*1000);
