Share

November 22, 2010

CFX: REST - Render Custom Exception

The Following is how i was able to map any Exception into a useful REST error message to caller..

What i needed to do is also response with the correct format xml or json.

Check out the following blog for how i got started with CFX.




Spring Config:




Java Code:



Note the 1st part of the java code will make sure to answer with the correct format XML or JSON. Also note that you need to make sure that the errorResponse is a jaxb object.