您应该使用@ExceptionHandler方法,该方法查看是否存在ETag标头并采取适当的措施:
@ExceptionHandler(UnsatisfiedServletRequestParameterException.class)public onErr400(@RequestHeader(value="ETag", required=false) String ETag, UnsatisfiedServletRequestParameterException ex) { if(ETag == null) { // Ok the problem was ETag Header : give your informational message } else { // It is another error 400 : simply say request is incorrect or use ex }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)