Grails

Request Filter not always triggered

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.2 final
  • Fix Version/s: 1.2.1
  • Component/s: None
  • Labels:
    None

Description

The request filter is not triggered on the default action of the controller when you specify a starts with for the controller name/uri.

For example, if go to (default action for binderController is index):
.../testAb/binder

the filters do not get executed.

Activity

Hide
Jeff Brown added a comment -

This may simply be a documentation issue. As the implementation is right now, the uri restriction uses an ant path style matcher while the controller restriction uses a regex. I think this makes sense, but isn't clear in the documentation.

The sample app has a filter that looks like this:

class RequestFilters {

    def filters = {
        uriCheck(uri: /bind.*/) {
            before = {
                // do something
            }
        }
    }
}

Depending on what you actually want to match, one of these may work:

class RequestFilters {

    def filters = {
        uriCheck(uri: '/bind*/**') {
            before = {
                // do something
            }
        }
    }
}
class RequestFilters {

    def filters = {
        uriCheck(uri: '/bind*/*') {
            before = {
                // do something
            }
        }
    }
}

It may be that we just need to add some information to the documentation to clarify that the uri value is an ant path expression, not a regex.

Show
Jeff Brown added a comment - This may simply be a documentation issue. As the implementation is right now, the uri restriction uses an ant path style matcher while the controller restriction uses a regex. I think this makes sense, but isn't clear in the documentation. The sample app has a filter that looks like this:
class RequestFilters {

    def filters = {
        uriCheck(uri: /bind.*/) {
            before = {
                // do something
            }
        }
    }
}
Depending on what you actually want to match, one of these may work:
class RequestFilters {

    def filters = {
        uriCheck(uri: '/bind*/**') {
            before = {
                // do something
            }
        }
    }
}
class RequestFilters {

    def filters = {
        uriCheck(uri: '/bind*/*') {
            before = {
                // do something
            }
        }
    }
}
It may be that we just need to add some information to the documentation to clarify that the uri value is an ant path expression, not a regex.
Hide
Jeff Brown added a comment -

The User Guide has been updated to point out that the uri attribute is specified as an ant style path.

http://github.com/grails/grails/commit/83d6ca4dba2c4d2f6d52ac415e63c0af7e86347e

Show
Jeff Brown added a comment - The User Guide has been updated to point out that the uri attribute is specified as an ant style path. http://github.com/grails/grails/commit/83d6ca4dba2c4d2f6d52ac415e63c0af7e86347e
Hide
Jeff Brown added a comment -

reopening to update the fix version

Show
Jeff Brown added a comment - reopening to update the fix version

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: