codeconsole opened a new pull request, #16499:
URL: https://github.com/apache/grails-core/pull/16499
## Description
The welcome page (`index.gsp`) that Forge and the `web` profile generate has
a **Servlet Filters** panel built from the call stack of the request rendering
`/`. It only listed the filters that ran for that one request, so a filter
mapped to other paths never appeared: `assetPipelineFilter` (`/assets/*`)
showed under **Filter Registrations** but not under **Servlet Filters**.
### Servlet Filters lists every filter in the container, in chain order
Each row shows the URL patterns (or servlet names) the filter handles.
- **Tomcat:** reads the context's filter maps (`findFilterMaps()`), the
table Tomcat builds each request's chain from. It covers
`FilterRegistrationBean`s, plain `Filter` beans Spring Boot adapts, and
container-added filters such as `WsFilter`.
- **Other containers:** replays the order Spring Boot registers its filters
in (`ServletContextInitializerBeans`, `matchAfter` registrations last), then
appends any other filters the Servlet API reports. Those are shown as `--`
because no portable API exposes their position.
- **Filter Registrations** is unchanged.
- `welcome.filters.request` is renamed to `welcome.filters.description` in
all 19 locales, since the panel no longer describes a single request.
On an 8.0.0-RC2 starter app:
| # | Filter | Paths |
|---|---|---|
| 01 | GrailsCorsFilter | `/*` |
| 02 | ServerHttpObservationFilter | `/*` |
| 03 | OrderedFormContentFilter | `/*` |
| 04 | GrailsSecurityHeadersFilter | `/*` |
| 05 | AssetPipelineFilter | `/assets/*` |
| 06 | OrderedCharacterEncodingFilter | `/*` |
| 07 | GrailsWebRequestFilter | `/*` |
| 08 | WsFilter | `/*` |
### New `grails-compile-static` Forge feature
The page compiles with static GSP compilation. An earlier draft of this
change didn't, and nothing in the build caught it, because no test compiled the
starter page statically. This PR adds a Forge feature that generates:
```groovy
grails {
compileStatic {
all = true
gsp = true // only when the application uses GSP
}
}
```
`CreateAppSpec` generates an application with the feature and runs
`compileGroovyPages`, so a starter page that doesn't compile statically now
fails the build. The test fails against that earlier draft of the template with
the expected `[Static type checking]` errors.
### Testing
- `GrailsGspSpec`, `GrailsDefaultPluginsSpec`, the new
`GrailsCompileStaticSpec` and `CreateAppSpec` pass.
- `./gradlew :grails-forge-core:codeStyle` passes.
- Ran the template in 8.0.0-RC1 and RC2 starter apps with dynamic GSPs, and
with static GSPs from a `bootJar`. Both the Tomcat path and a forced run of the
other-container path render the full chain.
## Contributor Checklist
### Issue and Scope
- [ ] This PR is linked to an existing issue that has been **acknowledged or
approved** by the project team. If no approved issue exists, please give
background on why this change is necessary. Tickets are preferred for release
change log history.
- [ ] This PR addresses the **complete scope** of the linked issue. Partial
implementations or unfinished work should not be submitted for review.
- [ ] This PR contains a **single, focused change**. Unrelated changes
should be submitted as separate pull requests.
- [x] This PR targets the **correct branch** for the type of change:
- **Patch release branches** (e.g., `7.0.x`): Bug fixes only. No new
features or API changes.
- **Minor release branches** (e.g., `7.1.x`): New features are welcome,
but breaking existing APIs must be avoided.
- **Major release branches** (e.g., `8.0.x`): Reserved for major
changes. Breaking API changes are permitted.
### Code Quality
- [x] I have **added or updated tests** that cover the changes introduced in
this PR. All code contributions are expected to include appropriate test
coverage.
- [ ] I have verified that all existing tests pass by running `./gradlew
build --rerun-tasks`.
- [x] My code follows the project's **code style** guidelines. I have run
`./gradlew codeStyle` and resolved any violations. See [Code
Style](../CONTRIBUTING.md#code-style) for details.
- [x] This PR does **not** include mass reformatting, style-only changes, or
large-scale refactoring unless it was **explicitly approved** in the linked
issue. Unsolicited reformatting will not be accepted.
- [ ] If generative AI tooling was used in preparing this contribution, a
quality model was used to ensure contributions are **consistent with the
project's quality standards**.
### Licensing and Attribution
- [ ] All contributed code is provided under the [Apache License
2.0](https://www.apache.org/licenses/LICENSE-2.0), and new source files include
the appropriate **Apache license header**.
- [ ] I have the necessary rights to submit this contribution and confirm it
is my own original work (see [Legal
Notice](../CONTRIBUTING.md#i-want-to-contribute)).
- [ ] If generative AI tooling was used in preparing this contribution, I
have followed the [Apache Software Foundation's policy on generative
tooling](https://www.apache.org/legal/generative-tooling.html) and have
properly attributed its use.
### Documentation
- [x] If this PR introduces user-facing changes, I have included or updated
the relevant documentation.
- [x] If this PR adds a new feature, I have updated the **What's New**
section of the Grails Guide.
- [ ] If this PR introduces breaking changes or changes that require user
action during an upgrade, I have updated the **Upgrade Notes** for the
corresponding version in the Grails Guide.
- [x] The PR description clearly explains **what** was changed and **why**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]