public class MockAsyncContext extends java.lang.Object implements AsyncContext
AsyncContext
interface.ASYNC_CONTEXT_PATH, ASYNC_PATH_INFO, ASYNC_QUERY_STRING, ASYNC_REQUEST_URI, ASYNC_SERVLET_PATH
Constructor and Description |
---|
MockAsyncContext(ServletRequest request,
ServletResponse response) |
Modifier and Type | Method and Description |
---|---|
void |
addDispatchHandler(java.lang.Runnable handler) |
void |
addListener(AsyncListener listener) |
void |
addListener(AsyncListener listener,
ServletRequest request,
ServletResponse response) |
void |
complete() |
<T extends AsyncListener> |
createListener(java.lang.Class<T> clazz) |
void |
dispatch() |
void |
dispatch(ServletContext context,
java.lang.String path) |
void |
dispatch(java.lang.String path) |
java.lang.String |
getDispatchedPath() |
java.util.List<AsyncListener> |
getListeners() |
ServletRequest |
getRequest() |
ServletResponse |
getResponse() |
long |
getTimeout() |
boolean |
hasOriginalRequestAndResponse() |
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.
|
void |
start(java.lang.Runnable runnable) |
public MockAsyncContext(ServletRequest request, @Nullable ServletResponse response)
public void addDispatchHandler(java.lang.Runnable handler)
public ServletRequest getRequest()
getRequest
in interface AsyncContext
@Nullable public ServletResponse getResponse()
getResponse
in interface AsyncContext
public boolean hasOriginalRequestAndResponse()
hasOriginalRequestAndResponse
in interface AsyncContext
public void dispatch()
dispatch
in interface AsyncContext
public void dispatch(java.lang.String path)
dispatch
in interface AsyncContext
public void dispatch(@Nullable ServletContext context, java.lang.String path)
dispatch
in interface AsyncContext
@Nullable public java.lang.String getDispatchedPath()
public void complete()
complete
in interface AsyncContext
public void start(java.lang.Runnable runnable)
start
in interface AsyncContext
public void addListener(AsyncListener listener)
addListener
in interface AsyncContext
public void addListener(AsyncListener listener, ServletRequest request, ServletResponse response)
addListener
in interface AsyncContext
public java.util.List<AsyncListener> getListeners()
public <T extends AsyncListener> T createListener(java.lang.Class<T> clazz) throws ServletException
createListener
in interface AsyncContext
ServletException
public void setTimeout(long timeout)
DeferredResult
or on
SseEmitter
.setTimeout
in interface AsyncContext
timeout
- the timeout value to use.AsyncContext.setTimeout(long)
public long getTimeout()
getTimeout
in interface AsyncContext