Package org.eclipse.jetty.server
Class HttpChannelState
java.lang.Object
org.eclipse.jetty.server.HttpChannelState
Implementation of AsyncContext interface that holds the state of request-response cycle.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The actions to take as the channel moves from state to state.private static enum
private static enum
private static enum
static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List
<javax.servlet.AsyncListener> private boolean
private final HttpChannel
private AsyncContextEvent
private boolean
private HttpChannelState.InputState
private HttpChannelState.OutputState
private HttpChannelState.RequestState
private boolean
private HttpChannelState.State
private long
private static final long
private static final Logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
void
addListener
(javax.servlet.AsyncListener listener) void
asyncError
(Throwable failure) protected void
protected void
cancelTimeout
(AsyncContextEvent event) boolean
void
complete()
protected void
boolean
protected void
void
getAttribute
(String name) (package private) ContextHandler
javax.servlet.ServletResponse
javax.servlet.ServletResponse
getState()
private String
long
handling()
boolean
hasListener
(javax.servlet.AsyncListener listener) boolean
isAsync()
boolean
(package private) boolean
boolean
boolean
isIdle()
boolean
boolean
boolean
boolean
boolean
private HttpChannelState.Action
nextAction
(boolean handling) boolean
Called to signal that content is now available to read.protected void
boolean
Called to signal that a read has read -1.boolean
Called to indicate that more content may be available, but that a handling thread may need to produce (fill/parse) it.boolean
Called to signal that the channel is ready for a callback.void
Called to signal async read isReady() has returned false.protected void
boolean
boolean
protected void
recycle()
void
removeAttribute
(String name) (package private) void
runInContext
(AsyncContextEvent event, Runnable runnable) protected void
void
private void
void
setAttribute
(String name, Object attribute) void
setTimeout
(long ms) void
startAsync
(AsyncContextEvent event) protected void
timeout()
toString()
private String
protected HttpChannelState.Action
unhandle()
Signal that the HttpConnection has finished handling the request.void
upgrade()
-
Field Details
-
LOG
-
DEFAULT_TIMEOUT
private static final long DEFAULT_TIMEOUT -
_channel
-
_asyncListeners
-
_state
-
_requestState
-
_outputState
-
_inputState
-
_initial
private boolean _initial -
_sendError
private boolean _sendError -
_asyncWritePossible
private boolean _asyncWritePossible -
_timeoutMs
private long _timeoutMs -
_event
-
-
Constructor Details
-
HttpChannelState
-
-
Method Details
-
getState
-
addListener
public void addListener(javax.servlet.AsyncListener listener) -
hasListener
public boolean hasListener(javax.servlet.AsyncListener listener) -
isSendError
public boolean isSendError() -
setTimeout
public void setTimeout(long ms) -
getTimeout
public long getTimeout() -
getAsyncContextEvent
-
toString
-
toStringLocked
-
getStatusStringLocked
-
getStatusString
-
commitResponse
public boolean commitResponse() -
partialResponse
public boolean partialResponse() -
completeResponse
public boolean completeResponse() -
isResponseCommitted
public boolean isResponseCommitted() -
isResponseCompleted
public boolean isResponseCompleted() -
abortResponse
public boolean abortResponse() -
handling
- Returns:
- Next handling of the request should proceed
-
unhandle
Signal that the HttpConnection has finished handling the request. For blocking connectors, this call may block if the request has been suspended (startAsync called).- Returns:
- next actions be handled again (eg because of a resume that happened before unhandle was called)
-
nextAction
-
startAsync
-
dispatch
-
timeout
protected void timeout() -
onTimeout
protected void onTimeout() -
complete
public void complete() -
asyncError
-
onError
-
sendError
-
sendError
-
completing
protected void completing() -
completed
-
recycle
protected void recycle() -
upgrade
public void upgrade() -
scheduleDispatch
protected void scheduleDispatch() -
cancelTimeout
protected void cancelTimeout() -
cancelTimeout
-
isIdle
public boolean isIdle() -
isExpired
public boolean isExpired() -
isInitial
public boolean isInitial() -
isSuspended
public boolean isSuspended() -
isCompleted
boolean isCompleted() -
isAsyncStarted
public boolean isAsyncStarted() -
isAsync
public boolean isAsync() -
getBaseRequest
-
getHttpChannel
-
getContextHandler
-
getContextHandler
-
getServletResponse
public javax.servlet.ServletResponse getServletResponse() -
getServletResponse
-
runInContext
-
getAttribute
-
removeAttribute
-
setAttribute
-
onReadUnready
public void onReadUnready()Called to signal async read isReady() has returned false. This indicates that there is no content available to be consumed and that once the channel enters the ASYNC_WAIT state it will register for read interest by callingHttpChannel.onAsyncWaitForContent()
either from this method or from a subsequent call tounhandle()
. -
onContentAdded
public boolean onContentAdded()Called to signal that content is now available to read. If the channel is in ASYNC_WAIT state and unready (ie isReady() has returned false), then the state is changed to ASYNC_WOKEN and true is returned.- Returns:
- True IFF the channel was unready and in ASYNC_WAIT state
-
onReadReady
public boolean onReadReady()Called to signal that the channel is ready for a callback. This is similar to callingonReadUnready()
followed byonContentAdded()
, except that as content is already available, read interest is never set.- Returns:
- true if woken
-
onReadPossible
public boolean onReadPossible()Called to indicate that more content may be available, but that a handling thread may need to produce (fill/parse) it. Typically called by the async read success callback.- Returns:
true
if more content may be available
-
onReadEof
public boolean onReadEof()Called to signal that a read has read -1. Will wake if the read was called while in ASYNC_WAIT state- Returns:
true
if woken
-
onWritePossible
public boolean onWritePossible()
-