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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With