i have exception mapper in jax-rs application (jersey 1.19):
public class illegalargumentexceptionmapper implements exceptionmapper<illegalargumentexception> { @override public response toresponse(illegalargumentexception e) { response.status status = response.status.bad_request; return response.status(status).entity(e.getmessage()).build(); } }
and works correctly (the client http status 400) in case:
@get @path("/test1") public string test2() { throw new illegalargumentexception("exception 1"); }
but if streaming output that:
@get @path("/test2") public string test2() { return new streamingoutput() { @override public void write(outputstream output) { throw new illegalargumentexception("exception 2"); } }; }
then exception mapper not used, , client gets http status 500. how can force use exception mapper?
Comments
Post a Comment