Swaraj Shekhar Swaraj Shekhar - 1 year ago 117
reST (reStructuredText) Question

Send response after rest authentication fails

I have over-ridden ContainerRequestFilters by class A and ContainerResponseFilters by Class B.

Now whenever there is a rest call, class A gets the request first and then it goes to another class, Class C.

The flow is, request comes to Class A, then it goes to class C and finally to Class B.

Now when I see that something is not good and I need to send a response, how can I do it from class A. I need to bypass class C.

Answer Source

Throw exception and catch it in your main class or using ExceptionMapper - Return exception from JAX-RS Rest Service as JSON.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download