Reputation: 3884
Here's the situation:
The problem is I have no idea what the Accept header is inside the toResponse method. I know I can extend the Exception class and pass the header in as a variable, which I can then use in toResponse, but I was hoping there would be a more 'correct' way to do this. I've tried adding the @Produces annotation to the toResponse method without success.
Has anyone successfully configured RESTEasy to easily return JSON or XML from toResponse?
-Dan
Upvotes: 6
Views: 7995
Reputation: 3884
Nevermind, I found the answer. I must have worded my question poorly, but I will leave this around in case someone stumbles upon it.
Here's the answer: JAX-RS (Jersey) custom exception with XML or JSON
Upvotes: 10