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.
精彩评论