Package org.springframework.mock.web
Class MockAsyncContext
java.lang.Object
org.springframework.mock.web.MockAsyncContext
- All Implemented Interfaces:
- AsyncContext
Mock implementation of the 
AsyncContext interface.- Since:
- 3.2
- Author:
- Rossen Stoyanchev
- 
Field SummaryFields inherited from interface jakarta.servlet.AsyncContextASYNC_CONTEXT_PATH, ASYNC_MAPPING, ASYNC_PATH_INFO, ASYNC_QUERY_STRING, ASYNC_REQUEST_URI, ASYNC_SERVLET_PATH
- 
Constructor SummaryConstructorsConstructorDescriptionMockAsyncContext(ServletRequest request, @Nullable ServletResponse response) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddDispatchHandler(Runnable handler) voidaddListener(AsyncListener listener) voidaddListener(AsyncListener listener, ServletRequest request, ServletResponse response) voidcomplete()<T extends AsyncListener>
 TcreateListener(Class<T> clazz) voiddispatch()voiddispatch(@Nullable ServletContext context, String path) voidlongbooleanvoidsetTimeout(long timeout) By default this is set to 10000 (10 seconds) even though the Servlet API specifies a default async request timeout of 30 seconds.void
- 
Constructor Details- 
MockAsyncContext
 
- 
- 
Method Details- 
addDispatchHandler
- 
getRequest- Specified by:
- getRequestin interface- AsyncContext
 
- 
getResponse- Specified by:
- getResponsein interface- AsyncContext
 
- 
hasOriginalRequestAndResponsepublic boolean hasOriginalRequestAndResponse()- Specified by:
- hasOriginalRequestAndResponsein interface- AsyncContext
 
- 
dispatchpublic void dispatch()- Specified by:
- dispatchin interface- AsyncContext
 
- 
dispatch- Specified by:
- dispatchin interface- AsyncContext
 
- 
dispatch- Specified by:
- dispatchin interface- AsyncContext
 
- 
getDispatchedPath
- 
completepublic void complete()- Specified by:
- completein interface- AsyncContext
 
- 
start- Specified by:
- startin interface- AsyncContext
 
- 
addListener- Specified by:
- addListenerin interface- AsyncContext
 
- 
addListener- Specified by:
- addListenerin interface- AsyncContext
 
- 
getListeners
- 
createListener- Specified by:
- createListenerin interface- AsyncContext
- Throws:
- ServletException
 
- 
setTimeoutpublic void setTimeout(long timeout) By default this is set to 10000 (10 seconds) even though the Servlet API specifies a default async request timeout of 30 seconds. Keep in mind the timeout could further be impacted by global configuration through the MVC Java config or the XML namespace, as well as be overridden per request onDeferredResultor onSseEmitter.- Specified by:
- setTimeoutin interface- AsyncContext
- Parameters:
- timeout- the timeout value to use.
- See Also:
 
- 
getTimeoutpublic long getTimeout()- Specified by:
- getTimeoutin interface- AsyncContext
 
 
-