JAX-RS (Jersey) custom exception with XML or JSON
问题 I have a REST service built using Jersey. I want to be able to set the MIME of my custom exception writers depending on the MIME that was sent to the server. application/json is returned when json is received, and application/xml when xml is received. Now I hard code application/json , but that's making the XML clients left in the dark. public class MyCustomException extends WebApplicationException { public MyCustomException(Status status, String message, String reason, int errorCode) { super