Skip to content

Commit 02851f4

Browse files
authored
Merge pull request #14989 from apache/sitemesh3-fix
2 parents 3a8f7fa + 3b8bced commit 02851f4

File tree

6 files changed

+14
-159
lines changed

6 files changed

+14
-159
lines changed

grails-gsp/grails-sitemesh3/src/main/groovy/org/grails/plugins/sitemesh3/Sitemesh3GrailsPlugin.groovy

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919

2020
package org.grails.plugins.sitemesh3
2121

22+
import grails.core.DefaultGrailsApplication
2223
import grails.plugins.Plugin
2324
import org.grails.config.PropertySourcesConfig
25+
import org.grails.gsp.compiler.GroovyPageParser
2426
import org.grails.plugins.web.taglib.RenderSitemeshTagLib
25-
import org.grails.plugins.web.taglib.SitemeshTagLib
2627
import org.grails.web.config.http.GrailsFilters
2728
import org.grails.web.util.WebUtils
2829
import org.springframework.core.env.ConfigurableEnvironment
@@ -47,7 +48,6 @@ class Sitemesh3GrailsPlugin extends Plugin {
4748

4849
def providedArtefacts = [
4950
RenderSitemeshTagLib,
50-
SitemeshTagLib,
5151
]
5252

5353
static PropertySource getDefaultPropertySource(ConfigurableEnvironment configurableEnvironment, String defaultLayout) {
@@ -69,19 +69,23 @@ class Sitemesh3GrailsPlugin extends Plugin {
6969
props.remove(it.key)
7070
}
7171
}
72-
return new MapPropertySource("sitemesh3Properties", props)
72+
return new MapPropertySource("defaultSitemesh3Properties", props)
7373
}
7474

7575

7676
Closure doWithSpring() {
7777
{ ->
78-
ConfigurableEnvironment configurableEnvironment = application.mainContext.environment
78+
ConfigurableEnvironment configurableEnvironment = grailsApplication.mainContext.environment as ConfigurableEnvironment
7979
def propertySources = configurableEnvironment.getPropertySources()
8080
// https://gsp.grails.org/latest/guide/layouts.html
8181
// Default view should be application, but it is inefficient to add a rule for a page that may not exist.
8282
String defaultLayout = grailsApplication.getConfig().getProperty("grails.sitemesh.default.layout")
8383
propertySources.addFirst(getDefaultPropertySource(configurableEnvironment, defaultLayout))
84-
application.config = new PropertySourcesConfig(propertySources)
84+
propertySources.addFirst(new MapPropertySource('requiredSitemesh3Properties', [
85+
(GroovyPageParser.CONFIG_PROPERTY_GSP_GRAILS_LAYOUT_PREPROCESS): 'false'
86+
]))
87+
(grailsApplication as DefaultGrailsApplication).config = new PropertySourcesConfig(propertySources)
88+
8589
grailsLayoutHandlerMapping(GrailsLayoutHandlerMapping)
8690
}
8791
}

grails-gsp/grails-sitemesh3/src/main/groovy/org/grails/plugins/web/taglib/RenderSitemeshTagLib.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ import grails.gsp.TagLib
3333

3434
import java.nio.CharBuffer
3535

36+
/**
37+
* The tags in this library are rendered by sitemesh itself instead of the grails tags so they should always be written
38+
* as a 'sitemesh' namespace.
39+
*/
3640
@TagLib
3741
class RenderSitemeshTagLib implements TagLibrary {
3842

grails-gsp/grails-sitemesh3/src/main/groovy/org/grails/plugins/web/taglib/SitemeshTagLib.groovy

Lines changed: 0 additions & 146 deletions
This file was deleted.

grails-gsp/spring-boot/src/main/java/grails/gsp/boot/GspAutoConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
import org.springframework.web.context.WebApplicationContext;
6969
import org.springframework.web.servlet.ViewResolver;
7070

71-
import org.grails.plugins.web.taglib.SitemeshTagLib;
7271
import org.grails.plugins.web.taglib.RenderTagLib;
7372

7473
import jakarta.servlet.ServletContext;
@@ -241,7 +240,7 @@ public GrailsApplication grailsApplication() {
241240

242241
protected static class TagLibraryLookupRegistrar implements ImportBeanDefinitionRegistrar {
243242

244-
public static final Class<?>[] DEFAULT_TAGLIB_CLASSES=new Class<?>[] { SitemeshTagLib.class, RenderTagLib.class, RenderSitemeshTagLib.class };
243+
public static final Class<?>[] DEFAULT_TAGLIB_CLASSES=new Class<?>[] { RenderTagLib.class, RenderSitemeshTagLib.class };
245244

246245
@Override
247246
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {

grails-test-examples/gsp-sitemesh3/src/integration-test/groovy/EndToEndSpec.groovy

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import spock.lang.PendingFeature
2424
@Integration
2525
class EndToEndSpec extends ContainerGebSpec {
2626

27-
@PendingFeature
2827
def 'simple layout'() {
2928
when:
3029
go('endToEnd/simpleLayout')
@@ -35,7 +34,6 @@ class EndToEndSpec extends ContainerGebSpec {
3534
</body></html>"""
3635
}
3736

38-
@PendingFeature
3937
def 'title in subtemplate'() {
4038
when:
4139
go('endToEnd/titleInSubtemplate')
@@ -58,7 +56,6 @@ class EndToEndSpec extends ContainerGebSpec {
5856
</body></html>"""
5957
}
6058

61-
@PendingFeature
6259
def 'parameters'() {
6360
when:
6461
go('endToEnd/parameters')
@@ -67,7 +64,6 @@ class EndToEndSpec extends ContainerGebSpec {
6764
pageSource == """<html><head></head><body><h1>pageProperty: here!</h1></body></html>"""
6865
}
6966

70-
@PendingFeature
7167
def 'parameters with logic'() {
7268
when:
7369
go('endToEnd/parametersWithLogic')
@@ -76,7 +72,6 @@ class EndToEndSpec extends ContainerGebSpec {
7672
pageSource == "<html><head></head><body>good</body></html>"
7773
}
7874

79-
@PendingFeature
8075
def 'multiline title'() {
8176
when:
8277
go('endToEnd/multilineTitle')

grails-testing-support-web/src/main/groovy/org/grails/testing/runtime/support/LazyTagLibraryLookup.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public LazyTagLibraryLookup() {
5858
}
5959
if(ClassUtils.isPresent("org.grails.plugins.sitemesh3.Sitemesh3GrailsPlugin", classLoader)) {
6060
try {
61-
mockedClasses.add(Class.forName("org.grails.plugins.web.taglib.SitemeshTagLib"));
6261
mockedClasses.add(Class.forName("org.grails.plugins.web.taglib.RenderSitemeshTagLib"));
6362
}
6463
catch(Exception ignored) {

0 commit comments

Comments
 (0)