spring AsyncWebRequestInterceptor 源码

  • 2022-08-08
  • 浏览 (357)

spring AsyncWebRequestInterceptor 代码

文件路径:/spring-web/src/main/java/org/springframework/web/context/request/AsyncWebRequestInterceptor.java

/*
 * Copyright 2002-2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.web.context.request;

/**
 * Extends {@code WebRequestInterceptor} with a callback method invoked during
 * asynchronous request handling.
 *
 * <p>When a handler starts asynchronous request handling, the DispatcherServlet
 * exits without invoking {@code postHandle} and {@code afterCompletion}, as it
 * normally does, since the results of request handling (e.g. ModelAndView) are
 * not available in the current thread and handling is not yet complete.
 * In such scenarios, the {@link #afterConcurrentHandlingStarted(WebRequest)}
 * method is invoked instead allowing implementations to perform tasks such as
 * cleaning up thread bound attributes.
 *
 * <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} as usual.
 *
 * @author Rossen Stoyanchev
 * @since 3.2
 *
 * @see org.springframework.web.context.request.async.WebAsyncManager
 */
public interface AsyncWebRequestInterceptor extends WebRequestInterceptor{

	/**
	 * Called instead of {@code postHandle} and {@code afterCompletion}, when the
	 * handler started handling the request concurrently.
	 * @param request the current request
	 */
	void afterConcurrentHandlingStarted(WebRequest request);

}

相关信息

spring 源码目录

相关文章

spring AbstractRequestAttributes 源码

spring AbstractRequestAttributesScope 源码

spring DestructionCallbackBindingListener 源码

spring FacesRequestAttributes 源码

spring FacesWebRequest 源码

spring NativeWebRequest 源码

spring RequestAttributes 源码

spring RequestContextHolder 源码

spring RequestContextListener 源码

spring RequestScope 源码

0  赞