Nov 2nd, 2011, 05:59 PM
Mapping Exceptions with http:inbound-channel-adapter and http:inbound-gateway
I would simply like to map Exceptions to HTTP error codes. For example, I want a bad JSON request to generate a 400 error code rather than the 500 that results from org.codehaus.jackson.map.JsonMappingException. Or I would like to map some sort of "not found" exception to 404. Currently, everything ends up as 500.
I have done the searching to see how Spring MVC uses a combination @ResponseStatus and @ExceptionHandler to do this on methods returning ModelAndView, but I don't know how to apply this knowledge on Http* classes in Spring Integration. Also, I wouldn't know how to do anything like this anyway with something like Jackson's JsonMappingException, which is thrown by framework classes and not by anything I wrote directly.
Any insight is appreciated.