Grails

Filters, before interceptor actionName not set.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major 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.

Issue Links

Activity

Hide
Jim Shingler added a comment -

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

Show
Jim Shingler added a comment - 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
Hide
Graeme Rocher added a comment -

The problem is not reproduceable (with attached sample) against SVN head

Show
Graeme Rocher added a comment - The problem is not reproduceable (with attached sample) against SVN head
Hide
Jim Shingler added a comment -

Thats good news. The problem was detected in 1.0-RC4. Other Changes against the Head must have solved the problem. I look forward to 1.0 being released.

Show
Jim Shingler added a comment - Thats good news. The problem was detected in 1.0-RC4. Other Changes against the Head must have solved the problem. I look forward to 1.0 being released.
Hide
Jim Shingler added a comment -

This still appears to be an issue.

I just extracted the attachment into a directory, Upgraded the project using grails upgrade and ran the application.

It appears that in the before interceptor, the actionName is not evaluated before the interceptor.

Output from console:

Welcome to Grails 1.0.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: C:\Apps\grails\grails-1.0.1\grails

. . .

=================> BEFORE: The actionName is now index
=================> AFTER: The actionName is now edit

On the BEFORE line, I expected the output to be edit.

Show
Jim Shingler added a comment - This still appears to be an issue. I just extracted the attachment into a directory, Upgraded the project using grails upgrade and ran the application. It appears that in the before interceptor, the actionName is not evaluated before the interceptor. Output from console: Welcome to Grails 1.0.1 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: C:\Apps\grails\grails-1.0.1\grails . . . =================> BEFORE: The actionName is now index =================> AFTER: The actionName is now edit On the BEFORE line, I expected the output to be edit.
Hide
Jim Shingler added a comment -

Please See comment above from 03/16/2008

Show
Jim Shingler added a comment - Please See comment above from 03/16/2008
Hide
T.Fischer added a comment -

I have the same problem. Sometimes the actionname ist null.

Normally I am using Firefox to test my application. But some customers use IE and there is the problem. With the same form the IE sents sometimes

code=An&password=xxxxx&_action_doLogin=Anmelden

and sometines

code=An&password=xxxxx

in the posted data. I don't know why.

So the grails framework ist not able to evaluate the actionname

Show
T.Fischer added a comment - I have the same problem. Sometimes the actionname ist null. Normally I am using Firefox to test my application. But some customers use IE and there is the problem. With the same form the IE sents sometimes code=An&password=xxxxx&_action_doLogin=Anmelden and sometines code=An&password=xxxxx in the posted data. I don't know why. So the grails framework ist not able to evaluate the actionname
Hide
Graeme Rocher added a comment -

Bulk closing bunch of resolved issues

Show
Graeme Rocher added a comment - Bulk closing bunch of resolved issues

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: