I try to configure a spring exception handler for a rest controller that is able to render a map to both xml and json based on the incoming accept header. It throws a 500 se
Thanx, seems I overread this. That's bad... any ideas how to provides exceptions automatically in xml/json format?
New in Spring 3.0 MappingJacksonJsonView can be utilized to achieve that:
private MappingJacksonJsonView jsonView = new MappingJacksonJsonView();
@ExceptionHandler(Exception.class)
public ModelAndView handleAnyException( Exception ex )
{
return new ModelAndView( jsonView, "error", new ErrorMessage( ex ) );
}