Discussion:
beforeInterceptor problem since grails-0.5.6
Thorsten Blum
2007-07-13 14:59:57 UTC
Permalink
Hi all,

after upgrading from grails-0.5 to grails-0.5.6 we're having problems
with our controllers using the "beforeInterceptor" and not having the
"index = {}" closure.

The following controller works fine, but if you uncomment "def index =
{}" the beforeInterceptor is not executed anymore and you get: "Not
Found RequestURI=/project/image".

Is this how it should behave? We would need "def index = {}" in every
controller using a beforeInterceptor although it's empty? Is this
correct?

class UserController extends AuthorizedAccessController {
def index = {}

def login = {...}
def logout = {....}
}

abstract class AuthorizedAccessController {
def beforeInterceptor = [ action: this.&auth, except: [ 'login' ] ]

private auth() {
if( !session.user ) {
redirect( controller: 'home' )
}
}
}

Any help would be very much appreciated!

Cheers
-Thorsten

---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email
Chris Chen
2007-07-13 18:09:43 UTC
Permalink
I am using 0.5.6 and I have a similar but more broad issue while I
was doing some code changes.

For me, when you don't have an index closure and scaffolding turned
off, all actions within the controller are not recognized. So it
appears that this is not an interceptor issue, but rather just the
fact that you need to either have an index or a scaffold set. This
might be caused by something else, but yea, my only way around this
is to set either:

def index = {...}
or
def defaultAction = "list"
or
def scaffold = true

I think it's the processing of a controller to find a default
action. If no default action is found or set, it automatically gives
an error.

-Chris
Post by Thorsten Blum
Hi all,
after upgrading from grails-0.5 to grails-0.5.6 we're having problems
with our controllers using the "beforeInterceptor" and not having the
"index = {}" closure.
The following controller works fine, but if you uncomment "def index =
{}" the beforeInterceptor is not executed anymore and you get: "Not
Found RequestURI=/project/image".
Is this how it should behave? We would need "def index = {}" in every
controller using a beforeInterceptor although it's empty? Is this
correct?
class UserController extends AuthorizedAccessController {
def index = {}
def login = {...}
def logout = {....}
}
abstract class AuthorizedAccessController {
def beforeInterceptor = [ action: this.&auth, except: [ 'login' ] ]
private auth() {
if( !session.user ) {
redirect( controller: 'home' )
}
}
}
Any help would be very much appreciated!
Cheers
-Thorsten
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Loading...