private void setDateAndCacheHeaders ( HttpResponse response , File fileToCache ) { SimpleDateFormat dateFormatter = new SimpleDateFormat ( HTTP_DATE_FORMAT , Locale . US ) ; dateFormatter . setTimeZone ( TimeZone . getTimeZone ( HTTP_DATE_GMT_TIMEZONE ) ) ; // Date header Calendar time = new GregorianCalendar ( ) ; response . setHeader ( HttpHeaders . Names . DATE , dateFormatter . format ( time . getTime ( ) ) ) ; // Add cache headers time . add ( Calendar . SECOND , HTTP_CACHE_SECONDS ) ; response . setHeader ( HttpHeaders . Names . EXPIRES , dateFormatter . format ( time . getTime ( ) ) ) ; response . setHeader ( HttpHeaders . Names . CACHE_CONTROL , "private, max-age=" + HTTP_CACHE_SECONDS ) ; response . setHeader ( HttpHeaders . Names . LAST_MODIFIED , dateFormatter . format ( new Date ( fileToCache . lastModified ( ) ) ) ) ; }
Sets the Date and Cache headers for the HTTP Response