Class HttpChannelState
- All Implemented Interfaces:
Components
,HttpChannel
,Invocable
Many methods return Runnable
s to indicate that further work is needed. These
can be given to an ExecutionStrategy instead of calling known methods like HttpChannel.handle().
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
The Channel's implementation of theResponse
API.Nested classes/interfaces inherited from interface org.eclipse.jetty.server.HttpChannel
HttpChannel.DefaultFactory, HttpChannel.Factory
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.Task
-
Field Summary
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking, NOOP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addHttpStreamWrapper
(Function<HttpStream, HttpStream> onStreamEvent) getCache()
A map-like object that can be used as a cache (for example, as a cookie cache).Returns theRequest
object, if available.void
Initialize the HttpChannel when a new cycle of request handling begins.boolean
onClose()
Notifies thisHttpChannel
that an asynchronous close happened.HttpStream
invokes this method when more HTTP request content is available.Notifies thisHttpChannel
that an asynchronous failure happened.Notifies thisHttpChannel
that an idle timeout happened.Notifies thisHttpChannel
that an asynchronous notification was received indicating a remote failure happened.onRequest
(MetaData.Request request) Start request handling by returning a Runnable that will callRequest.Handler.handle(Request, Response, Callback)
.void
recycle()
Recycle the HttpChannel, so that a new cycle of callingHttpChannel.setHttpStream(HttpStream)
,HttpChannel.onRequest(MetaData.Request)
etc.void
setHttpStream
(HttpStream stream) Set theHttpStream
to associate to this channel..toString()
-
Constructor Details
-
HttpChannelState
-
-
Method Details
-
initialize
public void initialize()Description copied from interface:HttpChannel
Initialize the HttpChannel when a new cycle of request handling begins.- Specified by:
initialize
in interfaceHttpChannel
- See Also:
-
getComplianceViolationListener
- Specified by:
getComplianceViolationListener
in interfaceHttpChannel
- Returns:
- the active
ComplianceViolation.Listener
-
recycle
public void recycle()Description copied from interface:HttpChannel
Recycle the HttpChannel, so that a new cycle of callingHttpChannel.setHttpStream(HttpStream)
,HttpChannel.onRequest(MetaData.Request)
etc. may be performed on the channel.- Specified by:
recycle
in interfaceHttpChannel
- See Also:
-
getHttpConfiguration
-
getHttpStream
-
setHttpStream
Description copied from interface:HttpChannel
Set theHttpStream
to associate to this channel..- Specified by:
setHttpStream
in interfaceHttpChannel
- Parameters:
stream
- theHttpStream
to associate to this channel.
-
getServer
-
getConnectionMetaData
- Specified by:
getConnectionMetaData
in interfaceHttpChannel
- Returns:
- the
ConnectionMetaData
associated with this channel.
-
getByteBufferPool
- Specified by:
getByteBufferPool
in interfaceComponents
- Returns:
- the
ByteBufferPool
associated with theRequest
-
getScheduler
- Specified by:
getScheduler
in interfaceComponents
- Returns:
- the
Scheduler
associated with theRequest
-
getThreadPool
- Specified by:
getThreadPool
in interfaceComponents
- Returns:
- the
ThreadPool
associated with theRequest
-
getExecutor
- Specified by:
getExecutor
in interfaceComponents
- Returns:
- the
Executor
associated with theRequest
-
getCache
Description copied from interface:Components
A map-like object that can be used as a cache (for example, as a cookie cache).
The cache will have a life cycle limited by the connection, i.e. no cache map will live longer that the connection associated with it. However, a cache may have a shorter life than a connection (e.g. it may be discarded for implementation reasons). A cache map is guaranteed to be given to only a single request concurrently (scoped by
HttpChannelState
), so objects saved there do not need to be made safe from access by simultaneous request. If the connection is known to be non-persistent then the cache may be a noop cache and discard all items set on it.- Specified by:
getCache
in interfaceComponents
- Returns:
- A map-like object, which may be an empty implementation that discards all items.
-
onRequest
Start request handling by returning a Runnable that will callRequest.Handler.handle(Request, Response, Callback)
.- Specified by:
onRequest
in interfaceHttpChannel
- Parameters:
request
- The request metadata to handle.- Returns:
- A Runnable that will call
Request.Handler.handle(Request, Response, Callback)
. Unlike all otherRunnable
s returned by HttpChannel methods, this runnable should not be mutually excluded or serialized. Specifically otherRunnable
s returned by methods on this class can be run concurrently with theRunnable
returned from this method.
-
getRequest
Description copied from interface:HttpChannel
Returns the
Request
object, if available.The
Request
object is only available after a call toHttpChannel.onRequest(MetaData.Request)
has been made.- Specified by:
getRequest
in interfaceHttpChannel
- Returns:
- the
Request
object, or null if theRequest
object is not yet available.
-
getResponse
-
isRequestHandled
public boolean isRequestHandled()- Specified by:
isRequestHandled
in interfaceHttpChannel
- Returns:
- whether the request has been passed to the root
Handler
.
-
onContentAvailable
Description copied from interface:HttpChannel
HttpStream
invokes this method when more HTTP request content is available.- Specified by:
onContentAvailable
in interfaceHttpChannel
- Returns:
- the last
Runnable
passed toRequest.demand(Runnable)
, ornull
if there is no demand for content.
-
getInvocationType
- Specified by:
getInvocationType
in interfaceInvocable
- Returns:
- The InvocationType of this object
-
onIdleTimeout
Description copied from interface:HttpChannel
Notifies this
HttpChannel
that an idle timeout happened.- Specified by:
onIdleTimeout
in interfaceHttpChannel
- Parameters:
t
- the timeout.- Returns:
- a
Runnable
that performs the timeout action, ornull
if no action need be performed by the calling thread - See Also:
-
onFailure
Description copied from interface:HttpChannel
Notifies this
HttpChannel
that an asynchronous failure happened.Typical failure examples could be protocol failures (for example, invalid request bytes).
- Specified by:
onFailure
in interfaceHttpChannel
- Parameters:
x
- the failure cause.- Returns:
- a
Runnable
that performs the failure action, ornull
if no failure action needs be performed by the calling thread - See Also:
-
onRemoteFailure
Description copied from interface:HttpChannel
Notifies this
HttpChannel
that an asynchronous notification was received indicating a remote failure happened.Typical failure examples could be HTTP/2 resets.
- Specified by:
onRemoteFailure
in interfaceHttpChannel
- Parameters:
x
- the failure cause.- Returns:
- a
Runnable
that performs the failure action, ornull
if no failure action needs be performed by the calling thread - See Also:
-
onClose
Description copied from interface:HttpChannel
Notifies this
HttpChannel
that an asynchronous close happened.- Specified by:
onClose
in interfaceHttpChannel
- Returns:
- a
Runnable
that performs the close action, ornull
if no close action needs be performed by the calling thread
-
addHttpStreamWrapper
-
toString
-