List of usage examples for org.springframework.web HttpMediaTypeNotSupportedException getLocalizedMessage
public String getLocalizedMessage()
From source file:be.bittich.quote.controller.impl.DefaultExceptionHandler.java
@RequestMapping(produces = APPLICATION_JSON) @ExceptionHandler(HttpMediaTypeNotSupportedException.class) @ResponseStatus(value = HttpStatus.UNSUPPORTED_MEDIA_TYPE) public @ResponseBody Map<String, Object> handleUnsupportedMediaTypeException( HttpMediaTypeNotSupportedException ex) throws IOException { Map<String, Object> map = newHashMap(); map.put("error", "Unsupported Media Type"); map.put("cause", ex.getLocalizedMessage()); map.put("supported", ex.getSupportedMediaTypes()); return map;/*from w w w .j a v a2 s. c o m*/ }