Skip to content

Commit 7c457b4

Browse files
committed
Simplify configuration of GSP. Fixes #9936
GroovyPagesGrailsPlugin was reading all plugin gsp/views.properties. This is unnecessary as these files were already read in the BinaryGrailsPlugin class and looked up via GroovyPageLocator from the binary plugins. This changes removes that logic and also adds a change to use classpath:gsp/views.properties which fixes the resolution of the default views.properties for unexploded deployment and for Jetty. See #9936
1 parent a262fd9 commit 7c457b4

File tree

1 file changed

+7
-25
lines changed

1 file changed

+7
-25
lines changed

grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/GroovyPagesGrailsPlugin.groovy

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -175,36 +175,18 @@ class GroovyPagesGrailsPlugin extends Plugin {
175175
}
176176
if (deployed) {
177177
Resource defaultViews = applicationContext?.getResource('gsp/views.properties')
178-
List<Resource> allViewsProperties = []
179178

180-
for(plugin in pluginManager?.allPlugins) {
181-
182-
def pluginViews = IOUtils.findResourceRelativeToClass(plugin.getPluginClass(), '/gsp/views.properties')
183-
if(pluginViews != null) {
184-
def res = new UrlResource(pluginViews)
185-
if(res.exists()) {
186-
allViewsProperties.add(res)
187-
}
188-
}
189-
}
190179
if(defaultViews != null) {
191-
allViewsProperties.add(defaultViews)
180+
if(!defaultViews.exists()) {
181+
defaultViews = applicationContext?.getResource('classpath:gsp/views.properties')
182+
}
192183
}
193184

194-
allViewsProperties = allViewsProperties?.findAll { Resource r ->
195-
def p = r.URL.path
196-
if(warDeployed && p.contains('/WEB-INF/classes')) {
197-
return true
185+
if(defaultViews.exists()) {
186+
precompiledGspMap = { PropertiesFactoryBean pfb ->
187+
ignoreResourceNotFound = true
188+
locations = [defaultViews] as Resource[]
198189
}
199-
else if(!warDeployed && !p.contains("!/lib")) {
200-
return true
201-
}
202-
203-
return false
204-
}
205-
precompiledGspMap = { PropertiesFactoryBean pfb ->
206-
ignoreResourceNotFound = true
207-
locations = allViewsProperties ? allViewsProperties as Resource[] : 'classpath:gsp/views.properties'
208190
}
209191
}
210192
if (enableReload) {

0 commit comments

Comments
 (0)