Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConfigurationHolder is deprecated - supress warning message #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions CacheHeadersGrailsPlugin.groovy
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import org.codehaus.groovy.grails.commons.ConfigurationHolder
import groovy.util.ConfigObject

class CacheHeadersGrailsPlugin {
def version = "1.1.5"
def version = "1.1.6"
def grailsVersion = "1.2.0 > *"
def dependsOn = ['controllers':'1.1 > *', 'logging':'1.1 > *']
def dependsOn = ['controllers':'1.1 > *']
def pluginExcludes = [
"grails-app/views/error.gsp",
"grails-app/controllers/**"
]

def author = "Marc Palmer"
def authorEmail = "marc@grailsrocks.com"
def author = "Graeme Rocher"
def authorEmail = "grocher@gopivotal.com"
def title = "Caching Headers Plugin"
def description = '''\\
Improve your application performance with browser caching, with easy ways to set caching headers in controller responses
'''

def developers = [ [ name: "Marc Palmer", email: "[email protected]" ], [ name: "Graeme Rocher", email: "[email protected]" ]]
def issueManagement = [ system: "JIRA", url: "http://jira.grails.org/browse/GPCACHEHEADERS" ]
def scm = [ url: "http://github.com/grails-plugins/grails-cache-headers" ]
def license = "APACHE"

def observe = ['controllers']

// URL to the plugin's documentation
Expand All @@ -32,8 +36,8 @@ Improve your application performance with browser caching, with easy ways to set
addCacheMethods(application, log)
}

void reloadConfig(svc, log) {
def conf = ConfigurationHolder.config.cache.headers
void reloadConfig(application, svc, log) {
def conf = application.config.cache.headers
def cacheSetting = conf.enabled
svc.enabled = ((cacheSetting instanceof String) || (cacheSetting instanceof Boolean)) ? Boolean.valueOf(cacheSetting.toString()) : true
svc.presets = conf.presets
Expand Down Expand Up @@ -67,7 +71,7 @@ Improve your application performance with browser caching, with easy ways to set

def doWithApplicationContext = { applicationContext ->
def svc = applicationContext.cacheHeadersService
reloadConfig(svc, log)
reloadConfig(application, svc, log)
}

def onChange = { event ->
Expand All @@ -77,6 +81,6 @@ Improve your application performance with browser caching, with easy ways to set
def onConfigChange = { event ->
// Config change might mean that the caching has been turned on/off
def svc = event.application.mainContext.cacheHeadersService
reloadConfig(svc, log)
reloadConfig(event.application, svc, log)
}
}
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Grails Cache Headers Plugin
====================


his plugin helps you Improve your application performance with browser caching, with easy ways to set caching headers in controller responses, and elegant ways to deal with ETag and Last-Modified generation and checking.
You can use this plugin to prevent caching of pages (eg forms), specify long term caching on infrequently changing content, and pass information to caching servers between the client and your app, and also to avoid regeneration of content if it has not changed since the client last downloaded it (even though the client may have an indication it has expired).

See [the documentation](http://grails.org/plugin/cache-headers) for more information
4 changes: 1 addition & 3 deletions application.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#Grails Metadata file
#Thu Apr 21 12:23:02 BST 2011
app.grails.version=1.3.7
app.grails.version=2.2.2
app.name=CacheHeaders
plugins.hibernate=1.3.7
plugins.tomcat=1.3.7