开发者

filter a servlet at method level

Is there a way to apply a filter to a servlet at method level? I don't want every method of开发者_运维技巧 the servlet to be filtered.

Maybe I should not use filters, I am not a java expert. I want to validate the FaceBook cookie in some methods of my GWT server code, but not all.

Thanks


This is not possible with a simple Filter mapping. It's however possible with a Java EE container managed security mapping (example here). So if this filter is intented to do authorization checks, then you might want to consider using container managed security instead. Otherwise you've to cast the ServletRequest back to HttpServletRequest and then determine the value of its getMethod() in the filter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜