Hi
I have an inbound interceptor were in a case of an exception I throw a new
Fault(e) exception.
What I want to achieve is to return a custom Response to the client from the
handleFault method of my interceptor.
I ve tried this but with no luck:
public class ESMAPISecurityInterceptor extends
AbstractPhaseInterceptor<Message> {
public ESMAPISecurityInterceptor(String phase) {
super(phase);
}
@Override
public void handleMessage(Message message) throws Fault {
try {
Class<?> c = Class.forName("an.invalid.class.name");
} catch (ClassNotFoundException e) {
throw new Fault(e);
}
}
@Override
public void handleFault(Message message) {
Response response = Response
.status(Status.INTERNAL_SERVER_ERROR)
.type(MediaType.APPLICATION_JSON)
.entity("error message").build();
message.setContent(Response.class, response);
message.getExchange().put(Response.class, response);
}
}
Is this possible? Is there any other way that I could return a custom
message back to the client from the handleFault() method?
Thanks
--
View this message in context:
http://cxf.547215.n5.nabble.com/Custom-Response-from-handleFault-JAX-RS-tp5738651.html
Sent from the cxf-user mailing list archive at Nabble.com.