public class AsyncServletServerHttpRequest extends ServletServerHttpRequest implements AsyncServerHttpRequest
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.atomic.AtomicBoolean |
asyncCompleted |
private AsyncContext |
asyncContext |
private java.util.List<java.lang.Runnable> |
completionHandlers |
private HttpServletResponse |
servletResponse |
private java.lang.Long |
timeout |
private java.util.List<java.lang.Runnable> |
timeoutHandlers |
FORM_CHARSET, FORM_CONTENT_TYPE
Constructor and Description |
---|
AsyncServletServerHttpRequest(HttpServletRequest request,
HttpServletResponse response)
Create a new instance for the given request/response pair.
|
Modifier and Type | Method and Description |
---|---|
void |
addCompletionHandler(java.lang.Runnable runnable) |
void |
addTimeoutHandler(java.lang.Runnable timeoutHandler) |
void |
completeAsync() |
boolean |
isAsyncCompleted()
Whether async request processing has completed.
|
boolean |
isAsyncStarted() |
void |
onComplete(AsyncEvent event) |
void |
onError(AsyncEvent event) |
void |
onStartAsync(AsyncEvent event) |
void |
onTimeout(AsyncEvent event) |
void |
setTimeout(long timeout)
Timeout period begins after the container thread has exited.
|
void |
startAsync() |
getBody, getCookies, getHeaders, getMethod, getPrincipal, getQueryParams, getRemoteAddress, getRemoteHostName, getServletRequest, getURI
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPrincipal, getQueryParams, getRemoteAddress, getRemoteHostName
getMethod, getURI
getBody
getCookies, getHeaders
private java.lang.Long timeout
private AsyncContext asyncContext
private java.util.concurrent.atomic.AtomicBoolean asyncCompleted
private final java.util.List<java.lang.Runnable> timeoutHandlers
private final java.util.List<java.lang.Runnable> completionHandlers
private final HttpServletResponse servletResponse
public AsyncServletServerHttpRequest(HttpServletRequest request, HttpServletResponse response)
public void setTimeout(long timeout)
setTimeout
in interface AsyncServerHttpRequest
public void addTimeoutHandler(java.lang.Runnable timeoutHandler)
public void addCompletionHandler(java.lang.Runnable runnable)
public boolean isAsyncStarted()
isAsyncStarted
in interface AsyncServerHttpRequest
public boolean isAsyncCompleted()
It is important to avoid use of request and response objects after async processing has completed. Servlet containers often re-use them.
isAsyncCompleted
in interface AsyncServerHttpRequest
public void startAsync()
startAsync
in interface AsyncServerHttpRequest
public void completeAsync()
completeAsync
in interface AsyncServerHttpRequest
public void onStartAsync(AsyncEvent event) throws java.io.IOException
java.io.IOException
public void onError(AsyncEvent event) throws java.io.IOException
java.io.IOException
public void onTimeout(AsyncEvent event) throws java.io.IOException
java.io.IOException
public void onComplete(AsyncEvent event) throws java.io.IOException
java.io.IOException