filters
目的 Purpose
The filters
plugin configures Grails' support for Filters.
使用例 Examples
An example filter:
class SecurityFilters { def filters = { loginCheck(controller: '*', action: '*') { before = { if (!session.user && !actionName.equals('login')) { redirect(action: 'login') return false } } } } }
Filter rule attributes:
controller
- controller matching pattern, by default * is replaced with .* and a regex is compiledaction
- action matching pattern, by default * is replaced with .* and a regex is compiledregex
(true
/false
) - use regex syntax (don't replace '*' with '.*')find
(true
/false
) - rule matches with partial match (seejava.util.regex.Matcher.find()
)invert
(true
/false
) - invert the rule (NOT rule)
詳細 Description
Refer to the section on Filters in the Grails user guide which details how filters work.
Configured Spring Beans:
filterInterceptor
- An instance of CompositeInterceptor that composes all the filters together into a single SpringInterceptor
.
Configured Spring Beans given a filter called SecurityFilters
:
SecurityFiltersClass
- The GrailsFiltersClass instance which aids in analyzing the conventions within the filter.SecurityFilters
- A singleton reference to the filter itself to support auto-wiring into a Filter