提交 0795ae5c 编写于 作者: J Juergen Hoeller

Polishing

上级 41ab177b
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -46,8 +46,8 @@ public interface HandlerExceptionResolver { ...@@ -46,8 +46,8 @@ public interface HandlerExceptionResolver {
* @param handler the executed handler, or {@code null} if none chosen at the * @param handler the executed handler, or {@code null} if none chosen at the
* time of the exception (for example, if multipart resolution failed) * time of the exception (for example, if multipart resolution failed)
* @param ex the exception that got thrown during handler execution * @param ex the exception that got thrown during handler execution
* @return a corresponding {@code ModelAndView} to forward to, or {@code null} * @return a corresponding {@code ModelAndView} to forward to,
* for default processing * or {@code null} for default processing in the resolution chain
*/ */
@Nullable @Nullable
ModelAndView resolveException( ModelAndView resolveException(
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
package org.springframework.web.servlet.handler; package org.springframework.web.servlet.handler;
import java.util.Set; import java.util.Set;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -241,10 +240,11 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti ...@@ -241,10 +240,11 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti
* @param handler the executed handler, or {@code null} if none chosen at the time * @param handler the executed handler, or {@code null} if none chosen at the time
* of the exception (for example, if multipart resolution failed) * of the exception (for example, if multipart resolution failed)
* @param ex the exception that got thrown during handler execution * @param ex the exception that got thrown during handler execution
* @return a corresponding {@code ModelAndView} to forward to, or {@code null} for default processing * @return a corresponding {@code ModelAndView} to forward to,
* or {@code null} for default processing in the resolution chain
*/ */
@Nullable @Nullable
protected abstract ModelAndView doResolveException(HttpServletRequest request, protected abstract ModelAndView doResolveException(
HttpServletResponse response, @Nullable Object handler, Exception ex); HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex);
} }
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -176,12 +176,13 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso ...@@ -176,12 +176,13 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
* @param handler the executed handler, or {@code null} if none chosen at the time * @param handler the executed handler, or {@code null} if none chosen at the time
* of the exception (for example, if multipart resolution failed) * of the exception (for example, if multipart resolution failed)
* @param ex the exception that got thrown during handler execution * @param ex the exception that got thrown during handler execution
* @return a corresponding ModelAndView to forward to, or {@code null} for default processing * @return a corresponding {@code ModelAndView} to forward to,
* or {@code null} for default processing in the resolution chain
*/ */
@Override @Override
@Nullable @Nullable
protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, protected ModelAndView doResolveException(
@Nullable Object handler, Exception ex) { HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) {
// Expose ModelAndView for chosen error view. // Expose ModelAndView for chosen error view.
String viewName = determineViewName(ex, request); String viewName = determineViewName(ex, request);
......
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -67,8 +67,8 @@ public class ResponseStatusExceptionResolver extends AbstractHandlerExceptionRes ...@@ -67,8 +67,8 @@ public class ResponseStatusExceptionResolver extends AbstractHandlerExceptionRes
@Override @Override
@Nullable @Nullable
protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, protected ModelAndView doResolveException(
@Nullable Object handler, Exception ex) { HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) {
try { try {
if (ex instanceof ResponseStatusException) { if (ex instanceof ResponseStatusException) {
...@@ -86,7 +86,7 @@ public class ResponseStatusExceptionResolver extends AbstractHandlerExceptionRes ...@@ -86,7 +86,7 @@ public class ResponseStatusExceptionResolver extends AbstractHandlerExceptionRes
} }
} }
catch (Exception resolveEx) { catch (Exception resolveEx) {
logger.warn("Handling of @ResponseStatus resulted in Exception", resolveEx); logger.warn("ResponseStatus handling resulted in exception", resolveEx);
} }
return null; return null;
} }
......
...@@ -164,8 +164,8 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes ...@@ -164,8 +164,8 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes
@Override @Override
@Nullable @Nullable
protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, protected ModelAndView doResolveException(
@Nullable Object handler, Exception ex) { HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) {
try { try {
if (ex instanceof HttpRequestMethodNotSupportedException) { if (ex instanceof HttpRequestMethodNotSupportedException) {
...@@ -547,7 +547,6 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes ...@@ -547,7 +547,6 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes
return new ModelAndView(); return new ModelAndView();
} }
/** /**
* Invoked to send a server error. Sets the status to 500 and also sets the * Invoked to send a server error. Sets the status to 500 and also sets the
* request attribute "javax.servlet.error.exception" to the Exception. * request attribute "javax.servlet.error.exception" to the Exception.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册