List of usage examples for org.springframework.http HttpStatus is4xxClientError
public boolean is4xxClientError()
From source file:cn.edu.zjnu.acm.judge.exception.GlobalExceptionHandler.java
@ExceptionHandler(MessageException.class) public String messageExceptionHandler(HttpServletRequest request, HttpServletResponse response, MessageException ex) {/*from w w w . j a va 2 s .c o m*/ String message = ex.getMessage(); HttpStatus code = ex.getHttpStatus(); try { message = messageSource.getMessage(message, null, localeResolver.resolveLocale(request)); } catch (NoSuchMessageException ignore) { } request.setAttribute("message", message); if (code.is4xxClientError()) { response.setStatus(code.value()); } return "message"; }