Polish Javadoc for AsyncHandlerInterceptor & RequestBodyAdvice

This commit is contained in:
Sam Brannen 2015-10-06 09:35:24 +02:00
parent 427767f21e
commit 7ac6af0fb0
2 changed files with 20 additions and 20 deletions

View File

@ -25,27 +25,27 @@ import org.springframework.web.method.HandlerMethod;
* Extends {@code HandlerInterceptor} with a callback method invoked after the
* start of asynchronous request handling.
*
* <p>When a handler starts an asynchronous request, the DispatcherServlet
* <p>When a handler starts an asynchronous request, the {@link DispatcherServlet}
* exits without invoking {@code postHandle} and {@code afterCompletion} as it
* normally does since the results of request handling (e.g. ModelAndView)
* is likely not yet ready and will be produced concurrently from another thread.
* In such scenarios, {@link #afterConcurrentHandlingStarted} is invoked instead
* allowing implementations to perform tasks such as cleaning up thread bound
* attributes before releasing the thread to the Servlet container.
* normally does for a synchronous request, since the result of request handling
* (e.g. ModelAndView) is likely not yet ready and will be produced concurrently
* from another thread. In such scenarios, {@link #afterConcurrentHandlingStarted}
* is invoked instead, allowing implementations to perform tasks such as cleaning
* up thread-bound attributes before releasing the thread to the Servlet container.
*
* <p>When asynchronous handling completes, the request is dispatched to the
* container for further processing. At this stage the DispatcherServlet invokes
* {@code preHandle}, {@code postHandle} and {@code afterCompletion}.
* container for further processing. At this stage the {@code DispatcherServlet}
* invokes {@code preHandle}, {@code postHandle}, and {@code afterCompletion}.
* To distinguish between the initial request and the subsequent dispatch
* after asynchronous handling completes, interceptors can check whether the
* {@code javax.servlet.DispatcherType} of {@link javax.servlet.ServletRequest}
* is "REQUEST" or "ASYNC".
* is {@code "REQUEST"} or {@code "ASYNC"}.
*
* <p>Note that {@code HandlerInterceptor} implementations may be need to do work
* <p>Note that {@code HandlerInterceptor} implementations may need to do work
* when an async request times out or completes with a network error. For such
* cases the Servlet container does not dispatch and therefore the
* {@code postHandle} and {@code afterCompletion} methods will not be invoked.
* Instead interceptors can register to track an asynchronous request through
* Instead, interceptors can register to track an asynchronous request through
* the {@code registerCallbackInterceptor} and {@code registerDeferredResultInterceptor}
* methods on {@link org.springframework.web.context.request.async.WebAsyncManager
* WebAsyncManager}. This can be done proactively on every request from
@ -62,14 +62,15 @@ public interface AsyncHandlerInterceptor extends HandlerInterceptor {
/**
* Called instead of {@code postHandle} and {@code afterCompletion}, when
* the a handler is being executed concurrently. Implementations may use the
* provided request and response but should avoid modifying them in ways
* that would conflict with the concurrent execution of the handler. A
* typical use of this method would be to clean thread local variables.
* the a handler is being executed concurrently.
* <p>Implementations may use the provided request and response but should
* avoid modifying them in ways that would conflict with the concurrent
* execution of the handler. A typical use of this method would be to
* clean up thread-local variables.
*
* @param request the current request
* @param response the current response
* @param handler handler (or {@link HandlerMethod}) that started async
* @param handler the handler (or {@link HandlerMethod}) that started async
* execution, for type and/or instance examination
* @throws Exception in case of errors
*/

View File

@ -23,12 +23,11 @@ import org.springframework.core.MethodParameter;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.converter.HttpMessageConverter;
/**
* Allows customizing the request before its body is read and converted into an
* Object and also allows the resulting Object before it is passed into a
* controller method as an {code @RequestBody} or an {@code HttpEntity} method
* argument.
* Object and also allows for processing of the resulting Object before it is
* passed into a controller method as an {@code @RequestBody} or an
* {@code HttpEntity} method argument.
*
* <p>Implementations of this contract may be registered directly with the
* {@code RequestMappingHandlerAdapter} or more likely annotated with