Last active
March 7, 2016 18:26
-
-
Save abhirockzz/5b4abe9716d9c772817d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Step 1: Define a custom annotation with the @NamedBinding annotation | |
@NameBinding | |
@Target({ ElementType.TYPE, ElementType.METHOD }) | |
@Retention(value = RetentionPolicy.RUNTIME) | |
public @interface Audited { } | |
Step 2: Apply the custom annotation on the filter or interceptor | |
@Provider | |
@Audited | |
public class AuditFilter implements ContainerRequestFilter { | |
//filter implementation.... | |
} | |
Step 3: Apply the same annotation to the required resource class or method | |
@GET | |
@Path("{id}") | |
@Produces("application/json") | |
@Audited | |
public Response find(@PathParam("id") String custId){ | |
//search and return customer info | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment