1

all, I want to use @ResponseStatus return a message to client,flow:

@ExceptionHandler(value = { Exception.class })
@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "not found mapping please check url")
@ResponseBody
public RestResponse<String> accessDenied() {
    RestResponse<String> restResponse = new RestResponse<String>();
    restResponse.setFailureMessageCn("xxxx");
    restResponse.setFailureMessagePt(messageSource.getMessage(
            "cemetery.operationFailed", null, LocaleUtils.toLocale("pt")));
    restResponse.setSuccess(false);
    restResponse.setBody(null);
    return restResponse;
}

but it cant not work. Advance thanks!

wilson
  • 281
  • 6
  • 22
  • Sounds like duplicate of http://stackoverflow.com/questions/5637950/spring-mvc-using-responsestatusreason-on-a-responsebody-exception-hand – kevin847 Apr 04 '13 at 16:48

0 Answers0