在 Jersey 中使用名称绑定注解注解、绑定、名称、Jersey

2023-09-06 10:52:40 作者:果味小可爱

@NameBinding 注释在 Jersey 中如何工作以对特定资源方法或资源类应用过滤器?

How does the @NameBinding annotation work in Jersey to apply a filter on particular resource methods or resource class?

考虑以下注释:

@NameBinding
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface SomeAnnotaion{}

它是如何工作的?

推荐答案

名称绑定

名称绑定 是一个概念,它允许对 JAX-RS 运行时说特定过滤器或拦截器将仅针对特定资源方法执行.当过滤器或拦截器仅限于特定的资源方法时,我们说它是name-bound.没有这种限制的过滤器和拦截器称为全局.

Name binding

Name binding is a concept that allows to say to a JAX-RS runtime that a specific filter or interceptor will be executed only for a specific resource method. When a filter or an interceptor is limited only to a specific resource method we say that it is name-bound. Filters and interceptors that do not have such a limitation are called global.

过滤器或拦截器可以使用