grails-filters

Grails throws a 404 error when canceling a page request with a filter

梦想的初衷 提交于 2019-12-23 17:23:13
问题 I have a filter: class MyFilters { def filters = { before = { render(view: "/test") return false } } } This works great on pages where I'm using a controller to handle the request, showing the contents of test.gsp instead of the page I requested. However, when I try to access a page that maps directly to a GSP file, I get a 404 error. Changing the render to simply render "test" produces the same results, as does commenting it out and just leaving the return false . 回答1: Grails is a MVC

Does Grails Filter `actionExclude` work with method-based routing?

♀尐吖头ヾ 提交于 2019-12-13 06:48:51
问题 I have a method-based route like: name base: "/" { controller="api" action=[GET: "welcome", POST: "post"] } And I'd like to apply a filter to handle authorization, e.g. class RequestFilters { def filters = { authorizeRequest(controller: 'api', actionExclude: 'welcome') { before = { log.debug("Applying authorization filter.") } } } } But when I apply this in practice, the filter runs on all requests (even GET requests, which should use the welcome method and thus should not trigger this filter

grails kickstart plugin KickstartFilters how to prevent password information on logs

和自甴很熟 提交于 2019-12-12 02:26:58
问题 I am using Grails version 2.2.4 and I have installed kickstart plugin as compile ":kickstart-with-bootstrap:0.9.6". BuildConfig.groovy plugins { runtime ":hibernate:$grailsVersion" runtime ":jquery:1.8.3" runtime ":resources:1.1.6" compile ":kickstart-with-bootstrap:0.9.6" build ":tomcat:$grailsVersion" runtime ":database-migration:1.3.2" compile ':cache:1.0.1' } I found "KickstartFilters.groovy" filter with following directory structure plugin -> kickstart-with-bootstrap:0.9.6 -> conf ->

How to define multiple distinct controllers in Grails 2 filter?

一世执手 提交于 2019-11-29 09:13:29
Is it possible to define multiple distinct controller in a Grails 2 web application filter? For example, something like: def filters = { someFilterMethod(controller: 'controller1 controller2 ...', action: '*') { ... } } Otherwise, is there a way to specify to not include the main index.gsp in the filter? Use the pipe symbol: def filters = { someFilterMethod(controller: 'controller1|controller2|...', action: '*') { ... } } If you can define a rule that matches index.gsp, then you can define a rule that matches everything but index.gsp by adding invert: true . I guess something like this should

How to define multiple distinct controllers in Grails 2 filter?

让人想犯罪 __ 提交于 2019-11-28 02:38:00
问题 Is it possible to define multiple distinct controller in a Grails 2 web application filter? For example, something like: def filters = { someFilterMethod(controller: 'controller1 controller2 ...', action: '*') { ... } } Otherwise, is there a way to specify to not include the main index.gsp in the filter? 回答1: Use the pipe symbol: def filters = { someFilterMethod(controller: 'controller1|controller2|...', action: '*') { ... } } 回答2: If you can define a rule that matches index.gsp, then you can