You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Grails when you refer to controller names, you use non-hyphenated references. For example with the createLink taglib or in URLMappings.
Actual Behaviour
But Interceptors match only work if you match with the hyphenated uri reference of the controller name.
When I see in the code (org.grails.plugins.web.interceptors.UrlMappingMatcher) it only seem to run the match against the request uri.
So in conclusion:
match(controller: "logEnvSwitch", action: "") does not work
match(controller: "log-env-switch", action: "") work
match(controller: "logEnvSwitch", action: "") does not work
match(controller: "log-env-switch", action: "") work
Consistent behavior would be support for both?
I do not think the behavior should be consistent for both. I think "logEnvSwitch" should be made to work. I don't think "log-env-switch" is intended to be supported. The value is supposed to be the property name version of the controller name and shouldn't have anything to do with URL mapping.
I agree with you, I don't think hyphenated references would work for taglibs or in URL mapping, which means supporting it in interceptors will only add more confusion.
I want to give an update as I am working on resolving this.
controllerName, actionName and namespace also prints the hyphenated names inside the interceptor. This may be the reason the matching is also not working, though I have not managed to figure out that part yet.
This seems to resolve the issue with controllerName, actionName and controllerNamespace inside the interceptor.
I feel I am in deep water here with my changes, I know there is some code duplication here but would like some feedback if this looks correct before refactoring it.
The bug with matching is something I need to look further into.
Steps to Reproduce
Expected Behaviour
In Grails when you refer to controller names, you use non-hyphenated references. For example with the createLink taglib or in URLMappings.
Actual Behaviour
But Interceptors match only work if you match with the hyphenated uri reference of the controller name.
When I see in the code (org.grails.plugins.web.interceptors.UrlMappingMatcher) it only seem to run the match against the request uri.
So in conclusion:
match(controller: "logEnvSwitch", action: "") does not work
match(controller: "log-env-switch", action: "") work
Consistent behavior would be support for both?
Environment Information
Example Application
https://github.com/olavgg/hyphenatedinterceptorbug
The text was updated successfully, but these errors were encountered: