Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-RC4
-
Fix Version/s: 1.0.2
-
Component/s: None
-
Labels:None
-
Environment:Windows XP, JDK 1.5, Grails 1.0RC-4
-
Testcase included:yes
Description
I am having an issue with filters, before interceptors, actionName is not set.
I created a quick example to illustrate the problem. Create a new user. then try go and edit the new user.
Take a look at the output on the console. It contains output from the UserFilters.
=================> BEFORE: The actionName is now index
=================> AFTER: The actionName is now edit
class UserFilters {
def filters = {
userModificationCheck(controller:'user', action:'*') {
before = {
def currActionName = (actionName == null ? 'index' : actionName)
println "=================> BEFORE: The actionName is now ${currActionName}"
}
after = {
def currActionName = (actionName == null ? 'index' : actionName)
println "=================> AFTER: The actionName is now ${currActionName}"
}
}
}
}
As you can see actionName is set properly on the after interceptor but not on the before interceptor. I would have expected the BEFORE: actionName to be edit.
Attachments
Issue Links
| This issue duplicates: | ||||
| GRAILS-2581 | actionName is null in filters when implicitly using index action in url |
|
|
|
The issue appears on Forms.
/filters/user/edit/1 works fine.
However, Forms use post and send the data ID=1&_action_Edit=Edit. At some point grails maps this to the edit action the problem is that the mapping to the edit action appears to be happening after the before filter has executed. I didn't expect that. IMO, The mapping should happend before the filter so that the actionName information is available.
Jim