public class HttpChannelState
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
HttpChannelState.Action
The actions to take as the channel moves from state to state.
|
private static class |
HttpChannelState.Async
The state of the servlet async API.
|
private static class |
HttpChannelState.AsyncRead |
static class |
HttpChannelState.State
The state of the HttpChannel,used to control the overall lifecycle.
|
Modifier and Type | Field and Description |
---|---|
private HttpChannelState.Async |
_async |
private java.util.List<javax.servlet.AsyncListener> |
_asyncListeners |
private HttpChannelState.AsyncRead |
_asyncRead |
private boolean |
_asyncWritePossible |
private HttpChannel |
_channel |
private AsyncContextEvent |
_event |
private boolean |
_initial |
private Locker |
_locker |
private HttpChannelState.State |
_state |
private long |
_timeoutMs |
private static long |
DEFAULT_TIMEOUT |
private static Logger |
LOG |
Modifier | Constructor and Description |
---|---|
protected |
HttpChannelState(HttpChannel channel) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(javax.servlet.AsyncListener listener) |
void |
asyncError(java.lang.Throwable failure) |
protected void |
cancelTimeout() |
protected void |
cancelTimeout(AsyncContextEvent event) |
void |
complete() |
void |
dispatch(javax.servlet.ServletContext context,
java.lang.String path) |
void |
errorComplete() |
AsyncContextEvent |
getAsyncContextEvent() |
java.lang.Object |
getAttribute(java.lang.String name) |
Request |
getBaseRequest() |
ContextHandler |
getContextHandler() |
(package private) ContextHandler |
getContextHandler(AsyncContextEvent event) |
HttpChannel |
getHttpChannel() |
javax.servlet.ServletResponse |
getServletResponse() |
javax.servlet.ServletResponse |
getServletResponse(AsyncContextEvent event) |
HttpChannelState.State |
getState() |
java.lang.String |
getStatusString() |
private java.lang.String |
getStatusStringLocked() |
long |
getTimeout() |
protected HttpChannelState.Action |
handling() |
boolean |
isAsync() |
boolean |
isAsyncComplete() |
boolean |
isAsyncStarted() |
(package private) boolean |
isCompleted() |
(package private) boolean |
isCompleting() |
boolean |
isExpired() |
boolean |
isIdle() |
boolean |
isInitial() |
boolean |
isSuspended() |
protected void |
onComplete() |
boolean |
onContentAdded()
Called to signal that content is now available to read.
|
protected void |
onError(java.lang.Throwable failure) |
boolean |
onReadEof()
Called to signal that a read has read -1.
|
boolean |
onReadPossible()
Called to indicate that more content may be available,
but that a handling thread may need to produce (fill/parse)
it.
|
boolean |
onReadReady()
Called to signal that the channel is ready for a callback.
|
void |
onReadUnready()
Called to signal async read isReady() has returned false.
|
protected void |
onTimeout() |
boolean |
onWritePossible() |
protected void |
recycle() |
void |
removeAttribute(java.lang.String name) |
(package private) void |
runInContext(AsyncContextEvent event,
java.lang.Runnable runnable) |
protected void |
scheduleDispatch() |
void |
setAttribute(java.lang.String name,
java.lang.Object attribute) |
void |
setTimeout(long ms) |
void |
startAsync(AsyncContextEvent event) |
java.lang.String |
toString() |
java.lang.String |
toStringLocked() |
protected HttpChannelState.Action |
unhandle()
Signal that the HttpConnection has finished handling the request.
|
void |
upgrade() |
private static final Logger LOG
private static final long DEFAULT_TIMEOUT
private final Locker _locker
private final HttpChannel _channel
private java.util.List<javax.servlet.AsyncListener> _asyncListeners
private HttpChannelState.State _state
private HttpChannelState.Async _async
private boolean _initial
private HttpChannelState.AsyncRead _asyncRead
private boolean _asyncWritePossible
private long _timeoutMs
private AsyncContextEvent _event
protected HttpChannelState(HttpChannel channel)
public HttpChannelState.State getState()
public void addListener(javax.servlet.AsyncListener listener)
public void setTimeout(long ms)
public long getTimeout()
public AsyncContextEvent getAsyncContextEvent()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringLocked()
private java.lang.String getStatusStringLocked()
public java.lang.String getStatusString()
protected HttpChannelState.Action handling()
public void startAsync(AsyncContextEvent event)
public void asyncError(java.lang.Throwable failure)
protected HttpChannelState.Action unhandle()
public void dispatch(javax.servlet.ServletContext context, java.lang.String path)
protected void onTimeout()
public void complete()
public void errorComplete()
protected void onError(java.lang.Throwable failure)
protected void onComplete()
protected void recycle()
public void upgrade()
protected void scheduleDispatch()
protected void cancelTimeout()
protected void cancelTimeout(AsyncContextEvent event)
public boolean isIdle()
public boolean isExpired()
public boolean isInitial()
public boolean isSuspended()
boolean isCompleting()
boolean isCompleted()
public boolean isAsyncStarted()
public boolean isAsyncComplete()
public boolean isAsync()
public Request getBaseRequest()
public HttpChannel getHttpChannel()
public ContextHandler getContextHandler()
ContextHandler getContextHandler(AsyncContextEvent event)
public javax.servlet.ServletResponse getServletResponse()
public javax.servlet.ServletResponse getServletResponse(AsyncContextEvent event)
void runInContext(AsyncContextEvent event, java.lang.Runnable runnable)
public java.lang.Object getAttribute(java.lang.String name)
public void removeAttribute(java.lang.String name)
public void setAttribute(java.lang.String name, java.lang.Object attribute)
public void onReadUnready()
HttpChannel.onAsyncWaitForContent()
either from this method or from a subsequent call to unhandle()
.public boolean onContentAdded()
public boolean onReadReady()
onReadUnready()
followed by
onContentAdded()
, except that as content is already
available, read interest is never set.public boolean onReadPossible()
true
if more content may be availablepublic boolean onReadEof()
true
if wokenpublic boolean onWritePossible()