使用Annotations保护Tapestry事件处理程序

时间:2011-11-19 19:28:38

标签: java annotations tapestry

我如何通过注释保护单个事件处理程序? 我知道如何保护完整页面,但如果方法有注释,我不知道如何在调用之前检查。

这可能吗?

我不想使用Spring-security

由于

2 个答案:

答案 0 :(得分:3)

ChenillKit访问是一个不错的模块。 还有基于安全框架Apache Shiro的tapestry-security模块,它提供了类似

的注释
@RequiresPermissions("news:delete")
  public void onActionFromDeleteNews(EventContext eventContext) {
     ...
  }

答案 1 :(得分:1)

使用Chenillekit access模块,您可以在Event方法上使用@Restricted注释,如下所示:

@Restricted(role = YOUR_ROLE_CONSTANT)
@OnEvent(value="eventName")
private Object handleEvent() throws Exception {
    ... your event code ....
}