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 Summary
Fields inherited from interface jakarta.servlet.AsyncContext
ASYNC_CONTEXT_PATH, ASYNC_MAPPING, ASYNC_PATH_INFO, ASYNC_QUERY_STRING, ASYNC_REQUEST_URI, ASYNC_SERVLET_PATH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDispatchHandler(Runnable handler) voidaddListener(AsyncListener listener) voidaddListener(AsyncListener listener, ServletRequest request, ServletResponse response) voidcomplete()<T extends AsyncListener>
TcreateListener(Class<T> clazz) voiddispatch()voiddispatch(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 interfaceAsyncContext
-
getResponse
- Specified by:
getResponsein interfaceAsyncContext
-
hasOriginalRequestAndResponse
public boolean hasOriginalRequestAndResponse()- Specified by:
hasOriginalRequestAndResponsein interfaceAsyncContext
-
dispatch
public void dispatch()- Specified by:
dispatchin interfaceAsyncContext
-
dispatch
- Specified by:
dispatchin interfaceAsyncContext
-
dispatch
- Specified by:
dispatchin interfaceAsyncContext
-
getDispatchedPath
-
complete
public void complete()- Specified by:
completein interfaceAsyncContext
-
start
- Specified by:
startin interfaceAsyncContext
-
addListener
- Specified by:
addListenerin interfaceAsyncContext
-
addListener
- Specified by:
addListenerin interfaceAsyncContext
-
getListeners
-
createListener
- Specified by:
createListenerin interfaceAsyncContext- Throws:
ServletException
-
setTimeout
public 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 interfaceAsyncContext- Parameters:
timeout- the timeout value to use.- See Also:
-
getTimeout
public long getTimeout()- Specified by:
getTimeoutin interfaceAsyncContext
-