@@ -28,13 +28,21 @@ import grails.util.GrailsUtil
28
28
import grails.util.Metadata
29
29
import grails.web.pages.GroovyPagesUriService
30
30
import groovy.transform.CompileStatic
31
- import groovy.util.logging.Commons
31
+ import groovy.util.logging.Slf4j
32
32
import org.grails.core.artefact.gsp.TagLibArtefactHandler
33
33
import org.grails.gsp.GroovyPageResourceLoader
34
34
import org.grails.gsp.GroovyPagesTemplateEngine
35
35
import org.grails.gsp.io.CachingGroovyPageStaticResourceLocator
36
36
import org.grails.gsp.jsp.TagLibraryResolverImpl
37
- import org.grails.plugins.web.taglib.*
37
+ import org.grails.plugins.web.taglib.ApplicationTagLib
38
+ import org.grails.plugins.web.taglib.CountryTagLib
39
+ import org.grails.plugins.web.taglib.FormTagLib
40
+ import org.grails.plugins.web.taglib.FormatTagLib
41
+ import org.grails.plugins.web.taglib.JavascriptTagLib
42
+ import org.grails.plugins.web.taglib.PluginTagLib
43
+ import org.grails.plugins.web.taglib.RenderTagLib
44
+ import org.grails.plugins.web.taglib.UrlMappingTagLib
45
+ import org.grails.plugins.web.taglib.ValidationTagLib
38
46
import org.grails.spring.RuntimeSpringConfiguration
39
47
import org.grails.taglib.TagLibraryLookup
40
48
import org.grails.taglib.TagLibraryMetaUtils
@@ -58,7 +66,7 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver
58
66
* @author Graeme Rocher
59
67
* @since 1.1
60
68
*/
61
- @Commons
69
+ @Slf4j
62
70
class GroovyPagesGrailsPlugin extends Plugin {
63
71
64
72
public static final String GSP_RELOAD_INTERVAL = " grails.gsp.reload.interval"
@@ -68,7 +76,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
68
76
" file:./grails-app/taglib/**/*TagLib.groovy" ]
69
77
70
78
def grailsVersion = " 7.0.0-SNAPSHOT > *"
71
- def dependsOn = [core : GrailsUtil . getGrailsVersion() , i18n : GrailsUtil . getGrailsVersion() ]
79
+ def dependsOn = [core : GrailsUtil . grailsVersion , i18n : GrailsUtil . grailsVersion ]
72
80
def observe = [' controllers' ]
73
81
def loadAfter = [' filters' ]
74
82
@@ -101,10 +109,10 @@ class GroovyPagesGrailsPlugin extends Plugin {
101
109
{ ->
102
110
def application = grailsApplication
103
111
Config config = application. config
104
- boolean developmentMode = isDevelopmentMode()
112
+ boolean developmentMode = developmentMode
105
113
Environment env = Environment . current
106
114
107
- boolean enableReload = env. isReloadEnabled() ||
115
+ boolean enableReload = env. reloadEnabled ||
108
116
config. getProperty(GroovyPagesTemplateEngine . CONFIG_PROPERTY_GSP_ENABLE_RELOAD , Boolean , false ) ||
109
117
(developmentMode && env == Environment . DEVELOPMENT )
110
118
@@ -134,7 +142,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
134
142
// as oppose to in WAR deployment where views are loaded from /WEB-INF
135
143
136
144
if (viewsDir) {
137
- log. info " Configuring GSP views directory as '${ viewsDir } '"
145
+ log. info( " Configuring GSP views directory as '${} '" , viewsDir)
138
146
customResourceLoader = true
139
147
groovyPageResourceLoader(GroovyPageResourceLoader ) {
140
148
baseResource = " file:${ viewsDir} "
@@ -158,7 +166,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
158
166
}
159
167
}
160
168
161
- def deployed = ! Metadata . getCurrent() . isDevelopmentEnvironmentAvailable()
169
+ def deployed = ! Metadata . current . developmentEnvironmentAvailable
162
170
groovyPageLocator(CachingGrailsConventionGroovyPageLocator ) { bean ->
163
171
bean. lazyInit = true
164
172
if (customResourceLoader) {
@@ -187,15 +195,15 @@ class GroovyPagesGrailsPlugin extends Plugin {
187
195
}
188
196
189
197
grailsResourceLocator(CachingGroovyPageStaticResourceLocator ) { bean ->
190
- bean. parent = " abstractGrailsResourceLocator"
198
+ bean. parent = ' abstractGrailsResourceLocator'
191
199
if (enableReload) {
192
200
cacheTimeout = gspCacheTimeout
193
201
}
194
202
}
195
203
196
204
// Setup the main templateEngine used to render GSPs
197
205
groovyPagesTemplateEngine(GroovyPagesTemplateEngine ) {
198
- classLoader = ref(" classLoader" )
206
+ classLoader = ref(' classLoader' )
199
207
groovyPageLocator = groovyPageLocator
200
208
if (enableReload) {
201
209
reloadEnabled = enableReload
@@ -209,7 +217,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
209
217
210
218
spring. addAlias(' groovyTemplateEngine' , ' groovyPagesTemplateEngine' )
211
219
212
- groovyPageRenderer(PageRenderer , ref(" groovyPagesTemplateEngine" )) { bean ->
220
+ groovyPageRenderer(PageRenderer , ref(' groovyPagesTemplateEngine' )) { bean ->
213
221
bean. lazyInit = true
214
222
groovyPageLocator = groovyPageLocator
215
223
}
@@ -227,7 +235,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
227
235
}
228
236
229
237
boolean jstlPresent = ClassUtils . isPresent(
230
- " jakarta.servlet.jsp.jstl.core.Config" , InternalResourceViewResolver . class. getClassLoader() )
238
+ ' jakarta.servlet.jsp.jstl.core.Config' , InternalResourceViewResolver . class. classLoader )
231
239
232
240
abstractViewResolver {
233
241
prefix = GrailsApplicationAttributes . PATH_TO_VIEWS
@@ -242,7 +250,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
242
250
// Configure a Spring MVC view resolver
243
251
jspViewResolver(GroovyPageViewResolver ) { bean ->
244
252
bean. lazyInit = true
245
- bean. parent = " abstractViewResolver"
253
+ bean. parent = ' abstractViewResolver'
246
254
}
247
255
248
256
// Now go through tag libraries and configure them in Spring too. With AOP proxies and so on
@@ -262,9 +270,9 @@ class GroovyPagesGrailsPlugin extends Plugin {
262
270
errorsViewStackTracePrinter(ErrorsViewStackTracePrinter , ref(' grailsResourceLocator' ))
263
271
filteringCodecsByContentTypeSettings(FilteringCodecsByContentTypeSettings , application)
264
272
265
- groovyPagesServlet(ServletRegistrationBean , new GroovyPagesServlet (), " *.gsp" ) {
266
- if (Environment . isDevelopmentMode() ) {
267
- initParameters = [showSource : " 1 " ]
273
+ groovyPagesServlet(ServletRegistrationBean , new GroovyPagesServlet (), ' *.gsp' ) {
274
+ if (Environment . developmentMode ) {
275
+ initParameters = [showSource : ' 1 ' ]
268
276
}
269
277
}
270
278
@@ -273,7 +281,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
273
281
}
274
282
275
283
protected boolean isDevelopmentMode () {
276
- Metadata . getCurrent() . isDevelopmentEnvironmentAvailable()
284
+ Metadata . current . developmentEnvironmentAvailable
277
285
}
278
286
279
287
static String transformToValidLocation (String location ) {
@@ -298,7 +306,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
298
306
}
299
307
}
300
308
301
- // The tag library lookup class caches " tag -> taglib class"
309
+ // The tag library lookup class caches ' tag -> taglib class'
302
310
// so we need to update it now.
303
311
def lookup = applicationContext. getBean(' gspTagLibraryLookup' , TagLibraryLookup )
304
312
lookup. registerTagLib(taglibClass)
0 commit comments