简体   繁体   中英

Jersey resource filters and OPTIONS method

I use Jersey for RESTful api in my application. I have some Resource, annotated with @ResourceFilters(value=...). Everything works fine with methods, declared in resource, but when I try to make OPTIONS request, filters do not work. Is there any way to make filters work for my case, or I need to declare explicit OPTIONS method?

ResourceFilter is really meant for filtering execution of resource methods. If you don't define OPTIONS method explicitly, the HTTP call does not get mapped to a resource method (is handled implicitly). You can use ContainerRequestFilter for that case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM