Incorrect `controllerName` after "filter-before" and HTTP-status URL-mapping (7.0.0)
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
Symptom discovered during migration of web-application from Grails v2.4.4 to v3.3.5, symptom still present in Grails v3.3.9.
### Task List
- [x] Steps to reproduce provided
- [x] Stacktrace (if present) provided
- [x] Example that reproduces the problem uploaded to Github
- [x] Full description of the issue provided (see below)
### Steps to Reproduce
#### Grails 3
1. clone Grails 3 [example](https://github.com/dlehammer/grails-core-issues-11216)
2. start application ~ `run-app`
3. open http://localhost:8339
4. notice how "first" is reported as `controllerName`, irregardless that `SecondController` is the only one executing `FooTagLib`.
```
foo.controllerName=first
```
#### Grails 2
1. clone Grails 2 [example](https://github.com/dlehammer/grails-core-issues-11216-grails2)
2. start application ~ `run-app`
3. open http://localhost:8244/my-webapp
4. last `controller` is reflected in `FooTagLib`
```
foo.controllerName=second
```
### Expected Behaviour
```
foo.controllerName=second
```
The `controller` executing `FooTagLib` is reflected consistently when using `controllerName` in `taglib`.
The examples are based on simplified steps for the following approach:
1. `filter`/`interceptor` check for access violation before proceeding to `controller`.
2. if access violation; send HTTP-status 403 (access denied)
3. redirect 403 via `URL-mapping` to `controller`, as described [here](http://docs.grails.org/3.3.9/guide/theWebLayer.html#mappingToResponseCodes).
4. `controller` renders human-readable response via `taglib`.
### Actual Behaviour
Unexpected:
```
foo.controllerName=first
```
### Environment Information
- **Operating System**: Ubuntu 16.04 (64-bit)
- **Grails Version:** 3.3.9
- **Grails 2 JDK Version:** OpenJDK Runtime Environment (Zulu 7.23.0.1-linux64) (build 1.7.0_181-b01)
- **Grails 3 JDK Version:** OpenJDK Runtime Environment (Zulu 8.30.0.1-linux64) (build 1.8.0_172-b01)
### Example Application
- [Grails v2.4.4](https://github.com/dlehammer/grails-core-issues-11216-grails2)
- [Grails v3.3.9](https://github.com/dlehammer/grails-core-issues-11216)
Contributor guide
Research direction
Start by running the linked Grails 3.3.9 example with `run-app` and compare its `FooTagLib` output with the Grails 2.4.4 example. Trace the filter/interceptor, HTTP 403 URL-mapping, and `SecondController` execution around `controllerName`. Done means the taglib reports `second` consistently in the described flow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100