@@ -29,6 +29,7 @@ import grails.util.Metadata
29
29
import grails.web.pages.GroovyPagesUriService
30
30
import groovy.transform.CompileStatic
31
31
import groovy.util.logging.Commons
32
+ import groovy.util.logging.Slf4j
32
33
import org.grails.core.artefact.gsp.TagLibArtefactHandler
33
34
import org.grails.gsp.GroovyPageResourceLoader
34
35
import org.grails.gsp.GroovyPagesTemplateEngine
@@ -58,7 +59,7 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver
58
59
* @author Graeme Rocher
59
60
* @since 1.1
60
61
*/
61
- @Commons
62
+ @Slf4j
62
63
class GroovyPagesGrailsPlugin extends Plugin {
63
64
64
65
public static final String GSP_RELOAD_INTERVAL = " grails.gsp.reload.interval"
@@ -68,7 +69,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
68
69
" file:./grails-app/taglib/**/*TagLib.groovy" ]
69
70
70
71
def grailsVersion = " 7.0.0-SNAPSHOT > *"
71
- def dependsOn = [core : GrailsUtil . getGrailsVersion() , i18n : GrailsUtil . getGrailsVersion() ]
72
+ def dependsOn = [core : GrailsUtil . grailsVersion , i18n : GrailsUtil . grailsVersion ]
72
73
def observe = [' controllers' ]
73
74
def loadAfter = [' filters' ]
74
75
@@ -101,10 +102,10 @@ class GroovyPagesGrailsPlugin extends Plugin {
101
102
{ ->
102
103
def application = grailsApplication
103
104
Config config = application. config
104
- boolean developmentMode = isDevelopmentMode()
105
+ boolean developmentMode = developmentMode
105
106
Environment env = Environment . current
106
107
107
- boolean enableReload = env. isReloadEnabled() ||
108
+ boolean enableReload = env. reloadEnabled ||
108
109
config. getProperty(GroovyPagesTemplateEngine . CONFIG_PROPERTY_GSP_ENABLE_RELOAD , Boolean , false ) ||
109
110
(developmentMode && env == Environment . DEVELOPMENT )
110
111
@@ -134,7 +135,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
134
135
// as oppose to in WAR deployment where views are loaded from /WEB-INF
135
136
136
137
if (viewsDir) {
137
- log. info " Configuring GSP views directory as '${ viewsDir } '"
138
+ log. info( " Configuring GSP views directory as '${} '" , viewsDir)
138
139
customResourceLoader = true
139
140
groovyPageResourceLoader(GroovyPageResourceLoader ) {
140
141
baseResource = " file:${ viewsDir} "
@@ -158,7 +159,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
158
159
}
159
160
}
160
161
161
- def deployed = ! Metadata . getCurrent() . isDevelopmentEnvironmentAvailable()
162
+ def deployed = ! Metadata . current . developmentEnvironmentAvailable
162
163
groovyPageLocator(CachingGrailsConventionGroovyPageLocator ) { bean ->
163
164
bean. lazyInit = true
164
165
if (customResourceLoader) {
@@ -187,15 +188,15 @@ class GroovyPagesGrailsPlugin extends Plugin {
187
188
}
188
189
189
190
grailsResourceLocator(CachingGroovyPageStaticResourceLocator ) { bean ->
190
- bean. parent = " abstractGrailsResourceLocator"
191
+ bean. parent = ' abstractGrailsResourceLocator'
191
192
if (enableReload) {
192
193
cacheTimeout = gspCacheTimeout
193
194
}
194
195
}
195
196
196
197
// Setup the main templateEngine used to render GSPs
197
198
groovyPagesTemplateEngine(GroovyPagesTemplateEngine ) {
198
- classLoader = ref(" classLoader" )
199
+ classLoader = ref(' classLoader' )
199
200
groovyPageLocator = groovyPageLocator
200
201
if (enableReload) {
201
202
reloadEnabled = enableReload
@@ -209,7 +210,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
209
210
210
211
spring. addAlias(' groovyTemplateEngine' , ' groovyPagesTemplateEngine' )
211
212
212
- groovyPageRenderer(PageRenderer , ref(" groovyPagesTemplateEngine" )) { bean ->
213
+ groovyPageRenderer(PageRenderer , ref(' groovyPagesTemplateEngine' )) { bean ->
213
214
bean. lazyInit = true
214
215
groovyPageLocator = groovyPageLocator
215
216
}
@@ -227,7 +228,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
227
228
}
228
229
229
230
boolean jstlPresent = ClassUtils . isPresent(
230
- " jakarta.servlet.jsp.jstl.core.Config" , InternalResourceViewResolver . class. getClassLoader() )
231
+ ' jakarta.servlet.jsp.jstl.core.Config' , InternalResourceViewResolver . class. classLoader )
231
232
232
233
abstractViewResolver {
233
234
prefix = GrailsApplicationAttributes . PATH_TO_VIEWS
@@ -242,7 +243,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
242
243
// Configure a Spring MVC view resolver
243
244
jspViewResolver(GroovyPageViewResolver ) { bean ->
244
245
bean. lazyInit = true
245
- bean. parent = " abstractViewResolver"
246
+ bean. parent = ' abstractViewResolver'
246
247
}
247
248
248
249
// Now go through tag libraries and configure them in Spring too. With AOP proxies and so on
@@ -262,9 +263,9 @@ class GroovyPagesGrailsPlugin extends Plugin {
262
263
errorsViewStackTracePrinter(ErrorsViewStackTracePrinter , ref(' grailsResourceLocator' ))
263
264
filteringCodecsByContentTypeSettings(FilteringCodecsByContentTypeSettings , application)
264
265
265
- groovyPagesServlet(ServletRegistrationBean , new GroovyPagesServlet (), " *.gsp" ) {
266
- if (Environment . isDevelopmentMode() ) {
267
- initParameters = [showSource : " 1 " ]
266
+ groovyPagesServlet(ServletRegistrationBean , new GroovyPagesServlet (), ' *.gsp' ) {
267
+ if (Environment . developmentMode ) {
268
+ initParameters = [showSource : ' 1 ' ]
268
269
}
269
270
}
270
271
@@ -273,7 +274,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
273
274
}
274
275
275
276
protected boolean isDevelopmentMode () {
276
- Metadata . getCurrent() . isDevelopmentEnvironmentAvailable()
277
+ Metadata . current . developmentEnvironmentAvailable
277
278
}
278
279
279
280
static String transformToValidLocation (String location ) {
@@ -298,7 +299,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
298
299
}
299
300
}
300
301
301
- // The tag library lookup class caches " tag -> taglib class"
302
+ // The tag library lookup class caches ' tag -> taglib class'
302
303
// so we need to update it now.
303
304
def lookup = applicationContext. getBean(' gspTagLibraryLookup' , TagLibraryLookup )
304
305
lookup. registerTagLib(taglibClass)
0 commit comments