Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have written a CustomValidationInterceptor. I want to configure this interceptor at service level with the use of annotations. Suppose, If I have exposed 5 services, and I want to configure the Interceptor for Only 1 of those service then how shall I do that

Following is my current code which is not firing the interceptor

@Service("someService")
@Path("somePath")
@InInterceptors(interceptors = { "com.telus.ffo.msl.service.impl.CustomValidationInterceptor" })
public class SystemCheckRestService {


    @POST
    @Path("/{phoneNumber}")
    @Produces({"application/json;charset=UTF-8"})
    public Response preRepairTest(@PathParam("phoneNumber") String phoneNumber) {
    // Code...
    }
}

Code snippet of My custom Interceptor is :

@Component
public class CustomValidationInterceptor extends AbstractPhaseInterceptor<Message>{

    public CustomValidationInterceptor() {
        super(Phase.PRE_INVOKE); // Put this interceptor in this phase
    }

    public void handleMessage(Message message) {
        // some code
     }

}
share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.