Package com.jalios.servlet.http
Class MockAsyncContext
- java.lang.Object
-
- com.jalios.servlet.http.MockAsyncContext
-
- All Implemented Interfaces:
javax.servlet.AsyncContext
public class MockAsyncContext extends java.lang.Object implements javax.servlet.AsyncContext
Mock implementation of theAsyncContext
interface.
-
-
Constructor Summary
Constructors Constructor Description MockAsyncContext(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDispatchHandler(java.lang.Runnable handler)
void
addListener(javax.servlet.AsyncListener listener)
void
addListener(javax.servlet.AsyncListener listener, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
void
complete()
<T extends javax.servlet.AsyncListener>
TcreateListener(java.lang.Class<T> clazz)
void
dispatch()
void
dispatch(java.lang.String path)
void
dispatch(javax.servlet.ServletContext context, java.lang.String path)
java.lang.String
getDispatchedPath()
java.util.List<javax.servlet.AsyncListener>
getListeners()
javax.servlet.ServletRequest
getRequest()
javax.servlet.ServletResponse
getResponse()
long
getTimeout()
boolean
hasOriginalRequestAndResponse()
static void
makeAccessible(java.lang.reflect.Constructor<?> ctor)
Make the given constructor accessible, explicitly setting it accessible if necessary.void
setTimeout(long timeout)
void
start(java.lang.Runnable runnable)
-
-
-
Method Detail
-
addDispatchHandler
public void addDispatchHandler(java.lang.Runnable handler)
-
getRequest
public javax.servlet.ServletRequest getRequest()
- Specified by:
getRequest
in interfacejavax.servlet.AsyncContext
-
getResponse
public javax.servlet.ServletResponse getResponse()
- Specified by:
getResponse
in interfacejavax.servlet.AsyncContext
-
hasOriginalRequestAndResponse
public boolean hasOriginalRequestAndResponse()
- Specified by:
hasOriginalRequestAndResponse
in interfacejavax.servlet.AsyncContext
-
dispatch
public void dispatch()
- Specified by:
dispatch
in interfacejavax.servlet.AsyncContext
-
dispatch
public void dispatch(java.lang.String path)
- Specified by:
dispatch
in interfacejavax.servlet.AsyncContext
-
dispatch
public void dispatch(javax.servlet.ServletContext context, java.lang.String path)
- Specified by:
dispatch
in interfacejavax.servlet.AsyncContext
-
getDispatchedPath
public java.lang.String getDispatchedPath()
-
complete
public void complete()
- Specified by:
complete
in interfacejavax.servlet.AsyncContext
-
start
public void start(java.lang.Runnable runnable)
- Specified by:
start
in interfacejavax.servlet.AsyncContext
-
addListener
public void addListener(javax.servlet.AsyncListener listener)
- Specified by:
addListener
in interfacejavax.servlet.AsyncContext
-
addListener
public void addListener(javax.servlet.AsyncListener listener, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
- Specified by:
addListener
in interfacejavax.servlet.AsyncContext
-
getListeners
public java.util.List<javax.servlet.AsyncListener> getListeners()
-
createListener
public <T extends javax.servlet.AsyncListener> T createListener(java.lang.Class<T> clazz) throws javax.servlet.ServletException
- Specified by:
createListener
in interfacejavax.servlet.AsyncContext
- Throws:
javax.servlet.ServletException
-
setTimeout
public void setTimeout(long timeout)
- Specified by:
setTimeout
in interfacejavax.servlet.AsyncContext
-
getTimeout
public long getTimeout()
- Specified by:
getTimeout
in interfacejavax.servlet.AsyncContext
-
makeAccessible
public static void makeAccessible(java.lang.reflect.Constructor<?> ctor)
Make the given constructor accessible, explicitly setting it accessible if necessary. ThesetAccessible(true)
method is only called when actually necessary, to avoid unnecessary conflicts with a JVM SecurityManager (if active).- Parameters:
ctor
- the constructor to make accessible- See Also:
Constructor.setAccessible(boolean)
-
-