...
|
...
|
@@ -11,9 +11,11 @@ import com.yohoufo.common.utils.ServletUtils; |
|
|
import org.apache.commons.httpclient.HttpStatus;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.web.bind.MissingServletRequestParameterException;
|
|
|
import org.springframework.web.bind.UnsatisfiedServletRequestParameterException;
|
|
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
|
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
...
|
...
|
@@ -52,7 +54,9 @@ public class GlobalDefaultExceptionHandler { |
|
|
}
|
|
|
|
|
|
//如果是请求URL匹配不了,则返回400
|
|
|
if (e instanceof UnsatisfiedServletRequestParameterException) {
|
|
|
if (e instanceof UnsatisfiedServletRequestParameterException
|
|
|
|| e instanceof MissingServletRequestParameterException
|
|
|
|| e instanceof MethodArgumentTypeMismatchException) {
|
|
|
log.warn("can not find validate request mapping at {}", request.getRequestURI());
|
|
|
response.setStatus(HttpStatus.SC_BAD_REQUEST);
|
|
|
return new ModelAndView();
|
...
|
...
|
|