过滤器在有插件的情况下怎么使用?
xiao0556
2008-05-14
我建了一个过滤器放在grails-app/conf下
class SecurityFilters{ def filters = { allURIs(uri:'/userManager/**') { if(!session.user.isLoggedIn()){ redirect(action:'show',controller:"login") return false; } } } } 结果报错 No thread-bound request found: Are you referring to request attributes outside of an actual web request? If you are actually operating within a web request and still receive this message,your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request. 是什么原因呢? |
|
oksonic
2008-06-19
class SecurityFilters { def filters = { loginCheck(controller:'*', action:'*') { before = { if(!session.user && !actionName.equals('login')) { redirect(action:'login') return false } } } } } 加上 before 包就可以实现了,不过只能在action事件中过滤器才会有用 |
|
jimichan
2008-06-19
综合一下:
class SecurityFilters { def filters = { loginCheck(uri:'/userManager/**') { before = { if(!session.user && !actionName.equals('login')) { redirect(action:'show',controller:"login") return false } } } } } 这样应该是可以的 |
|
xiao0556
2008-06-20
谢谢楼上两位
|
相关讨论
相关资源推荐
- tapestry页面编辑组件
- tapestry-5:Apache Tapestry 5的镜像
- tapestry
- 关于Tapestry的一些个人总结
- tapestry-cometd:基于 CometD 的 Tapestry5 推送库
- TSH.rar_Tapestry spring_tapestry_tapestry hiberna_tapestry workb
- extjs_tapestry.rar_extjs tapestry_extjs_tapestry_tapestry
- Tapestry开发指南
- Tapestry简单入门.rar_java Tapestry_tapestry
- 深入浅出Tapestry