@RequestMapping("/test1")
public ResponseEntity<?> testControllerAdvice(String id) {
if (StringUtils.isEmpty(id)) {
throw new UserNotExistException(id);
}
//能设置返回的状态码,和请求头 可以拆解为@ResponseBody和@ResponseStatus
return new ResponseEntity<String>("正常", HttpStatus.BAD_REQUEST);
}
相关文章
- 11-14SpringMVC使用ResponseEntity实现文件下载
- 11-14Vue + Axios Excel 请求后台下载 ResponseEntity
- 11-14ResponseEntity
- 11-14Nginx采坑日记(后台响应ResponseEntity时,Nginx将部分数据过滤)
- 11-14文件上传(使用springmvc框架中ResponseEntity对象)
- 11-14第七节:HttpEntity 与 ResponseEntity
- 11-14@ResponseBody ResponseEntity
- 11-14[转发]SPRING MVC3.2案例讲解--SPRING MVC3的@ResponseBody和ResponseEntity
- 11-14ResponseEntity<List>接收结果时报错: java.util.LinkedHashMap cannot be cast to ***