I have a JAX-RS based web application. The application includes 2 types of APIs:
- typical rest(json) enpoints
- endpoint, which duplicates rest, but receives requests in XML format.
Both API produces different format response.
- json
- XML
I currently have single ExceptionMapper, to catch exceptions like:EJBAccessException, NotAllowedException...
Which can be produced by both API types.
My question: which is the best way to separate exception handling?
(reaction to same exception for rest api should generate JSON response, for XML - xml response)