-
-
Notifications
You must be signed in to change notification settings - Fork 970
Filterless Sitemesh 3 #15585
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
Open
codeconsole
wants to merge
27
commits into
apache:7.2.x
Choose a base branch
from
codeconsole:feature/sitemesh3-viewresolver
base: 7.2.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Filterless Sitemesh 3 #15585
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
09b8b7f
feat(sitemesh3): add capture page and taglib
codeconsole d25d531
feat(sitemesh3): add capture-aware content processor
codeconsole 62b3f43
feat(sitemesh3): add view-resolver dispatch context
codeconsole b6d3e2b
feat(sitemesh3): add layout view, resolver, and post-processor
codeconsole a89f62a
feat(sitemesh3): add convention-based decorator selector
codeconsole 512755c
refactor(sitemesh3): wire plugin to view-resolver path, drop filter
codeconsole 858b46d
test(sitemesh3): add specs for new components
codeconsole c2b44b9
fix(sitemesh3): correct decoration second-pass, layout capture isolat…
codeconsole 06523ae
perf(sitemesh3): eliminate the decoration-phase HTML parse
codeconsole 71921cd
fix(sitemesh3): use view-resolver dispatch for <g:applyLayout>
codeconsole 01e158c
perf(sitemesh3): pass captured buffers as CharSequence, not String
codeconsole d3dd277
fix(sitemesh3): review fixes — null-guard, prefix match, unused impor…
codeconsole 517baf3
build(sitemesh3): bump to 3.2.3-SNAPSHOT for view-resolver integration
codeconsole 99a7e8d
refactor(sitemesh3): consume upstream spring-webmvc-sitemesh module
codeconsole ee00982
test(sitemesh3): specs for Grails BPP + view/context subclasses
codeconsole 41ba93c
perf/fix(sitemesh3): review follow-ups — volatile flag, extractHead l…
codeconsole cb3d5ab
refactor(sitemesh3): drop field duplication in GrailsSiteMeshView
codeconsole eb2b3c1
build: allow org.sitemesh.* snapshots from central.sonatype.com
codeconsole 792e2e7
fix spec
codeconsole 497e6b6
code style changes
codeconsole 64173fa
Merge branch '7.1.x' into feature/sitemesh3-viewresolver
codeconsole 5a6d36d
async support for sitemesh 3
codeconsole fe603f6
Merge branch '7.2.x' into feature/sitemesh3-viewresolver
codeconsole 2b48c76
various fixes
codeconsole 665c42d
Fix layout dispatch to route absolute paths through ViewResolver
codeconsole 692f169
sitemesh 2 doc update
codeconsole 35d1d4d
Merge remote-tracking branch 'upstream/7.2.x' into feature/sitemesh3-…
codeconsole File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,4 +137,4 @@ class GrailsVersionSpec extends Specification { | |
| thrown(IllegalArgumentException) | ||
| } | ||
|
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| //// | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| https://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| //// | ||
|
|
||
| === Upgrade Instructions for Grails 7.1 to Grails 7.2 | ||
|
|
||
| This guide outlines the changes introduced in Grails 7.2 and the steps required to upgrade your application. | ||
|
|
||
| ==== 1. SiteMesh 3 Filter-less Integration | ||
|
|
||
| Grails 7.2 upgrades the SiteMesh 3 integration to a *filter-less* architecture. Decoration is now performed by a Spring MVC `ViewResolver` rather than a Servlet filter. This change improves performance, eliminates ordering issues with other filters, and correctly supports async controller return types (`Callable`, `@Async`). | ||
|
|
||
| ===== What Changed | ||
|
|
||
| * The `SiteMeshFilter` servlet filter is no longer active. A `NoopSitemeshFilter` placeholder bean is registered under the `sitemesh` name to prevent SiteMesh's auto-configuration from activating the upstream filter-based integration. | ||
| * Layout resolution and decoration are now handled by `Sitemesh3LayoutView` (a Spring `View`) and `CaptureAwareContentProcessor`. | ||
| * GSP pages populate a `Sitemesh3CapturedPage` at render time via the `grailsLayout` capture tag library. SiteMesh no longer parses the raw HTML response to extract head/body/title. | ||
|
|
||
| ===== Required Actions | ||
|
|
||
| For most applications **no changes are required**. The filter-less integration is a drop-in replacement: layouts, `<g:layoutHead>`, `<g:layoutTitle>`, `<g:layoutBody>`, `<g:pageProperty>`, `<g:applyLayout>`, and layout-by-convention all behave identically to the previous release. | ||
|
|
||
| [IMPORTANT] | ||
| ==== | ||
| The guidance below applies *only* when the SiteMesh 3 integration is in use. The legacy `grails-layout` plugin (SiteMesh 2) remains supported in Grails 7.2 and continues to honor its existing configuration. If your application still depends on `grails-layout`, leave the SiteMesh 2 properties in place — they remain meaningful for that codepath. | ||
| ==== | ||
|
|
||
| When using the SiteMesh 3 integration, the following SiteMesh 2-era configuration properties are no longer consulted and can be removed from your `application.yml` if present: | ||
|
|
||
| [source,yaml] | ||
| ---- | ||
| # Remove these — no longer used by the SiteMesh 3 integration in Grails 7.2. | ||
| # (Retain them if your application still uses the grails-layout / SiteMesh 2 plugin.) | ||
| grails.gsp.view.layoutViewResolver: false | ||
| sitemesh.filter.order: ... | ||
| sitemesh.decorator.tagRuleBundles: ... | ||
| ---- | ||
|
|
||
| ===== Configuring the Default Layout | ||
|
|
||
| The default layout is still configured via: | ||
|
|
||
| [source,yaml] | ||
| .grails-app/conf/application.yml | ||
| ---- | ||
| grails: | ||
| sitemesh: | ||
| default: | ||
| layout: application | ||
| ---- | ||
|
|
||
| ===== Layout Cache Tuning (Optional) | ||
|
|
||
| In non-development environments, layout paths are cached by controller/action pair. The cache TTL can be tuned independently of the GSP reload interval using a dedicated key: | ||
|
|
||
| [source,yaml] | ||
| .grails-app/conf/application.yml | ||
| ---- | ||
| grails: | ||
| sitemesh: | ||
| layout: | ||
| cache: | ||
| interval: 5000 # milliseconds, default 5000 | ||
| ---- | ||
|
|
||
| This replaces any reliance on `grails.gsp.reload.interval` for layout cache expiration in previous snapshots. | ||
|
|
||
| ===== Async Controller Support | ||
|
|
||
| The filter-less architecture correctly handles Grails controllers that return `Callable` or use `@Async`. Previously, async dispatch could cause decoration to run on a different thread from the one that populated the SiteMesh request scope, leading to empty layouts or stale content. This is resolved in 7.2. | ||
|
|
||
| ===== Content Blocks | ||
|
|
||
| Content blocks (the `<content tag="...">` pattern) continue to work as before. The GSP preprocessor maps them to `<grailsLayout:captureContent tag="...">` at compile time, and the captured buffers are passed directly to the layout without an additional HTML parse. | ||
|
|
||
| [source,xml] | ||
| ---- | ||
| <%-- Page --%> | ||
| <content tag="sidebar"> | ||
| ... sidebar content ... | ||
| </content> | ||
|
|
||
| <%-- Layout --%> | ||
| <div id="sidebar"> | ||
| <g:pageProperty name="page.sidebar" /> | ||
| </div> | ||
| ---- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 0 additions & 68 deletions
68
...ls-sitemesh3/src/main/groovy/org/grails/plugins/sitemesh3/GrailsLayoutHandlerMapping.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.