List of usage examples for org.springframework.web HttpMediaTypeNotSupportedException getMessage
public String getMessage()
From source file:net.jkratz.igdb.controller.advice.ErrorController.java
@RequestMapping(produces = "application/json") @ExceptionHandler(HttpMediaTypeNotSupportedException.class) @ResponseStatus(value = HttpStatus.UNSUPPORTED_MEDIA_TYPE) public @ResponseBody Map<String, Object> handleUnsupportedMediaTypeException( HttpMediaTypeNotSupportedException ex) throws IOException { logger.warn(ex.getMessage()); Map<String, Object> map = Maps.newHashMap(); map.put("error", "Unsupported Media Type"); map.put("message", ex.getMessage()); map.put("supported", ex.getSupportedMediaTypes()); return map;//w ww. ja v a 2 s . c o m }
From source file:com.pkrete.locationservice.admin.controller.rest.v1.RestExceptionHandler.java
@ExceptionHandler(HttpMediaTypeNotSupportedException.class) @ResponseBody/* w w w. j a v a 2 s.c o m*/ protected Map handleHttpMediaTypeNotSupportedException(HttpMediaTypeNotSupportedException ex, WebRequest request, HttpServletResponse response) { // Set response status response.setStatus(415); // Create Map containing all the fields Map errors = new HashMap<String, String>(); // Add error message errors.put("error", ex.getMessage()); // Return error return errors; }