Pablo Castilla
Pablo Castilla

Reputation: 2741

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

Upvotes: 1

Views: 227

Answers (1)

BalusC
BalusC

Reputation: 1108722

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.

Upvotes: 1

Related Questions