开发者

filter a servlet at method level

开发者 https://www.devze.com 2023-02-12 22:28 出处:网络
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.

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

精彩评论

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

关注公众号