Created
December 21, 2010 10:55
-
-
Save deluan/749785 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.deluan.grails.util | |
import java.text.SimpleDateFormat | |
import com.grailsrocks.cacheheaders.DateFormatterThreadLocal | |
/** | |
* This class is used to force CacheHeadersService (from the cache-headers | |
* plugin) to generate http-dates in english. It MUST be used when the | |
* locale of your server is not English. | |
* <p/> | |
* To use it, put the following configuration in your Config.groovy: | |
* <pre> | |
* beans { | |
* cacheHeadersService { | |
* dateFormatters = new com.deluan.grails.util.EnglishDateFormatterThreadLocal() | |
* } | |
* } | |
* </pre> | |
* | |
* @author Deluan | |
*/ | |
class EnglishDateFormatterThreadLocal extends DateFormatterThreadLocal { | |
SimpleDateFormat initialValue() { | |
def v = new SimpleDateFormat(RFC1123_DATE_FORMAT, Locale.ENGLISH) | |
v.timeZone = TimeZone.getTimeZone('GMT') | |
return v | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment