Skip to content

Commit 28c07a6

Browse files
committed
Polish Javadoc for MVC exception handling classes
1 parent 3db62d5 commit 28c07a6

File tree

5 files changed

+65
-62
lines changed

5 files changed

+65
-62
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerExceptionResolver.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,32 +20,32 @@
2020
import javax.servlet.http.HttpServletResponse;
2121

2222
/**
23-
* Interface to be implemented by objects than can resolve exceptions thrown
24-
* during handler mapping or execution, in the typical case to error views.
25-
* Implementors are typically registered as beans in the application context.
23+
* Interface to be implemented by objects that can resolve exceptions thrown during
24+
* handler mapping or execution, in the typical case to error views. Implementors are
25+
* typically registered as beans in the application context.
2626
*
27-
* <p>Error views are analogous to the error page JSPs, but can be used with
28-
* any kind of exception including any checked exception, with potentially
29-
* fine-granular mappings for specific handlers.
27+
* <p>Error views are analogous to JSP error pages but can be used with any kind of
28+
* exception including any checked exception, with potentially fine-grained mappings for
29+
* specific handlers.
3030
*
3131
* @author Juergen Hoeller
3232
* @since 22.11.2003
3333
*/
3434
public interface HandlerExceptionResolver {
3535

3636
/**
37-
* Try to resolve the given exception that got thrown during on handler execution,
38-
* returning a ModelAndView that represents a specific error page if appropriate.
39-
* <p>The returned ModelAndView may be {@linkplain ModelAndView#isEmpty() empty}
37+
* Try to resolve the given exception that got thrown during handler execution,
38+
* returning a {@link ModelAndView} that represents a specific error page if appropriate.
39+
* <p>The returned {@code ModelAndView} may be {@linkplain ModelAndView#isEmpty() empty}
4040
* to indicate that the exception has been resolved successfully but that no view
4141
* should be rendered, for instance by setting a status code.
4242
* @param request current HTTP request
4343
* @param response current HTTP response
4444
* @param handler the executed handler, or {@code null} if none chosen at the
4545
* time of the exception (for example, if multipart resolution failed)
4646
* @param ex the exception that got thrown during handler execution
47-
* @return a corresponding ModelAndView to forward to,
48-
* or {@code null} for default processing
47+
* @return a corresponding {@code ModelAndView} to forward to, or {@code null}
48+
* for default processing
4949
*/
5050
ModelAndView resolveException(
5151
HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex);

spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerExceptionResolver.java

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@
3030
/**
3131
* Abstract base class for {@link HandlerExceptionResolver} implementations.
3232
*
33-
* <p>Provides a set of mapped handlers that the resolver should map to,
34-
* and the {@link Ordered} implementation.
33+
* <p>Supports mapped {@linkplain #setMappedHandlers handlers} and
34+
* {@linkplain #setMappedHandlerClasses handler classes} that the resolver
35+
* should be applied to and implements the {@link Ordered} interface.
3536
*
3637
* @author Arjen Poutsma
3738
* @author Juergen Hoeller
39+
* @author Sam Brannen
3840
* @since 3.0
3941
*/
4042
public abstract class AbstractHandlerExceptionResolver implements HandlerExceptionResolver, Ordered {
@@ -67,10 +69,10 @@ public int getOrder() {
6769

6870
/**
6971
* Specify the set of handlers that this exception resolver should apply to.
70-
* The exception mappings and the default error view will only apply to the specified handlers.
71-
* <p>If no handlers and handler classes are set, the exception mappings and the default error
72+
* <p>The exception mappings and the default error view will only apply to the specified handlers.
73+
* <p>If no handlers or handler classes are set, the exception mappings and the default error
7274
* view will apply to all handlers. This means that a specified default error view will be used
73-
* as fallback for all exceptions; any further HandlerExceptionResolvers in the chain will be
75+
* as a fallback for all exceptions; any further HandlerExceptionResolvers in the chain will be
7476
* ignored in this case.
7577
*/
7678
public void setMappedHandlers(Set<?> mappedHandlers) {
@@ -79,11 +81,11 @@ public void setMappedHandlers(Set<?> mappedHandlers) {
7981

8082
/**
8183
* Specify the set of classes that this exception resolver should apply to.
82-
* The exception mappings and the default error view will only apply to handlers of the
83-
* specified type; the specified types may be interfaces and superclasses of handlers as well.
84-
* <p>If no handlers and handler classes are set, the exception mappings and the default error
84+
* <p>The exception mappings and the default error view will only apply to handlers of the
85+
* specified types; the specified types may be interfaces or superclasses of handlers as well.
86+
* <p>If no handlers or handler classes are set, the exception mappings and the default error
8587
* view will apply to all handlers. This means that a specified default error view will be used
86-
* as fallback for all exceptions; any further HandlerExceptionResolvers in the chain will be
88+
* as a fallback for all exceptions; any further HandlerExceptionResolvers in the chain will be
8789
* ignored in this case.
8890
*/
8991
public void setMappedHandlerClasses(Class<?>[] mappedHandlerClasses) {
@@ -92,11 +94,11 @@ public void setMappedHandlerClasses(Class<?>[] mappedHandlerClasses) {
9294

9395
/**
9496
* Set the log category for warn logging. The name will be passed to the underlying logger
95-
* implementation through Commons Logging, getting interpreted as log category according
97+
* implementation through Commons Logging, getting interpreted as a log category according
9698
* to the logger's configuration.
9799
* <p>Default is warn logging using the {@link AbstractHandlerExceptionResolver} class name derived logger.
98-
* Set to {@code null} to disable warn logging.
99-
* Override the {@link #logException} method for custom logging.
100+
* <p>Set to {@code null} to disable warn logging.
101+
* <p>Override the {@link #logException} method for custom logging.
100102
* @see org.apache.commons.logging.LogFactory#getLog(String)
101103
* @see org.apache.log4j.Logger#getLogger(String)
102104
* @see java.util.logging.Logger#getLogger(String)
@@ -107,19 +109,19 @@ public void setWarnLogCategory(String loggerName) {
107109

108110
/**
109111
* Specify whether to prevent HTTP response caching for any view resolved
110-
* by this HandlerExceptionResolver.
111-
* <p>Default is "false". Switch this to "true" in order to automatically
112-
* generate HTTP response headers that suppress response caching.
112+
* by this exception resolver.
113+
* <p>Default is {@code false}. Switch this to {@code true} in order to
114+
* automatically generate HTTP response headers that suppress response caching.
113115
*/
114116
public void setPreventResponseCaching(boolean preventResponseCaching) {
115117
this.preventResponseCaching = preventResponseCaching;
116118
}
117119

118-
119120
/**
120-
* Checks whether this resolver is supposed to apply (i.e. the handler matches
121-
* in case of "mappedHandlers" having been specified), then delegates to the
122-
* {@link #doResolveException} template method.
121+
* Check whether this resolver is supposed to apply (i.e. if the supplied handler
122+
* matches any of the configured {@linkplain #setMappedHandlers handlers} or
123+
* {@linkplain #setMappedHandlerClasses handler classes}), and then delegate
124+
* to the {@link #doResolveException} template method.
123125
*/
124126
@Override
125127
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response,
@@ -145,8 +147,9 @@ public ModelAndView resolveException(HttpServletRequest request, HttpServletResp
145147

146148
/**
147149
* Check whether this resolver is supposed to apply to the given handler.
148-
* <p>The default implementation checks against the specified mapped handlers
149-
* and handler classes, if any.
150+
* <p>The default implementation checks against the configured
151+
* {@linkplain #setMappedHandlers handlers} and
152+
* {@linkplain #setMappedHandlerClasses handler classes}, if any.
150153
* @param request current HTTP request
151154
* @param handler the executed handler, or {@code null} if none chosen
152155
* at the time of the exception (for example, if multipart resolution failed)
@@ -222,10 +225,9 @@ protected void preventCaching(HttpServletResponse response) {
222225
response.addHeader(HEADER_CACHE_CONTROL, "no-store");
223226
}
224227

225-
226228
/**
227-
* Actually resolve the given exception that got thrown during on handler execution,
228-
* returning a ModelAndView that represents a specific error page if appropriate.
229+
* Actually resolve the given exception that got thrown during handler execution,
230+
* returning a {@link ModelAndView} that represents a specific error page if appropriate.
229231
* <p>May be overridden in subclasses, in order to apply specific exception checks.
230232
* Note that this template method will be invoked <i>after</i> checking whether this
231233
* resolved applies ("mappedHandlers" etc), so an implementation may simply proceed
@@ -235,7 +237,7 @@ protected void preventCaching(HttpServletResponse response) {
235237
* @param handler the executed handler, or {@code null} if none chosen at the time
236238
* of the exception (for example, if multipart resolution failed)
237239
* @param ex the exception that got thrown during handler execution
238-
* @return a corresponding ModelAndView to forward to, or {@code null} for default processing
240+
* @return a corresponding {@code ModelAndView} to forward to, or {@code null} for default processing
239241
*/
240242
protected abstract ModelAndView doResolveException(HttpServletRequest request,
241243
HttpServletResponse response, Object handler, Exception ex);

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/JsonViewResponseBodyAdvice.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*
3333
* <p>The serialization view specified in the annotation will be passed in to the
3434
* {@link org.springframework.http.converter.json.MappingJackson2HttpMessageConverter}
35-
* which will then use it to serialize the response body with.
35+
* which will then use it to serialize the response body.
3636
*
3737
* <p>Note that despite {@code @JsonView} allowing for more than one class to
3838
* be specified, the use for a response body advice is only supported with

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyAdvice.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
2424

2525
/**
2626
* Allows customizing the response after the execution of an {@code @ResponseBody}
27-
* or an {@code ResponseEntity} controller method but before the body is written
27+
* or a {@code ResponseEntity} controller method but before the body is written
2828
* with an {@code HttpMessageConverter}.
2929
*
3030
* <p>Implementations may be may be registered directly with

0 commit comments

Comments
 (0)