@TargetSE(valueSE=ANNOTATION_TYPESE) @RetentionSE(valueSE=RUNTIMESE) @DocumentedSE public @interface NameBinding
@NameBinding
メタアノテーションを使用して定義されます。@Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(value = RetentionPolicy.RUNTIME) @NameBinding public @interface Logged { }次に、定義された名前バインディングアノテーションを使用して、フィルターまたはインターセプタークラスを装飾します(複数のフィルターまたはインターセプターを同じ名前バインディングアノテーションで装飾できます)。
@Logged public class LoggingFilter implements ContainerRequestFilter, ContainerResponseFilter { ... }最後に、名前バインディングアノテーションが、名前バインド JAX-RS プロバイダーをバインドする必要のあるリソースメソッドに適用されます。
@Path("/") public class MyResourceClass { @GET @Produces("text/plain") @Path("{name}") @Logged public String hello(@PathParam("name") String name) { return "Hello " + name; } }名前バインディングアノテーションは、カスタム JAX-RS
Application
サブクラスに添付することもできます。このような場合、アノテーションによってバインドされた名前にバインドされた JAX-RS プロバイダーは、JAX-RS アプリケーションのすべての resource and sub-resource methods
に適用されます。@Logged @ApplicationPath("myApp") public class MyApplication extends jakarta.ws.rs.core.Application { ... }
Copyright © 2018,2020 Eclipse Foundation.
Use is subject to license terms.