Class HttpChannelState
- All Implemented Interfaces:
Components,HttpChannel,Invocable
Many methods return Runnables 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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classThe Channel's implementation of theResponseAPI.Nested classes/interfaces inherited from interface org.eclipse.jetty.server.HttpChannel
HttpChannel.DefaultFactory, HttpChannel.FactoryNested 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHttpStreamWrapper(Function<HttpStream, HttpStream> onStreamEvent) getCache()A map-like object that can be used as a cache (for example, as a cookie cache).Returns theRequestobject, if available.voidInitialize the HttpChannel when a new cycle of request handling begins.booleanonClose()Notifies thisHttpChannelthat an asynchronous close happened.HttpStreaminvokes this method when more HTTP request content is available.Notifies thisHttpChannelthat an asynchronous failure happened.Notifies thisHttpChannelthat an idle timeout happened.Notifies thisHttpChannelthat 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).voidrecycle()Recycle the HttpChannel, so that a new cycle of callingHttpChannel.setHttpStream(HttpStream),HttpChannel.onRequest(MetaData.Request)etc. may be performed on the channel.voidsetHttpStream(HttpStream stream) Set theHttpStreamto associate to this channel..toString()
-
Constructor Details
-
HttpChannelState
-
-
Method Details
-
initialize
public void initialize()Description copied from interface:HttpChannelInitialize the HttpChannel when a new cycle of request handling begins.- Specified by:
initializein interfaceHttpChannel- See Also:
-
getComplianceViolationListener
- Specified by:
getComplianceViolationListenerin interfaceHttpChannel- Returns:
- the active
ComplianceViolation.Listener
-
recycle
public void recycle()Description copied from interface:HttpChannelRecycle the HttpChannel, so that a new cycle of callingHttpChannel.setHttpStream(HttpStream),HttpChannel.onRequest(MetaData.Request)etc. may be performed on the channel.- Specified by:
recyclein interfaceHttpChannel- See Also:
-
getHttpConfiguration
-
getHttpStream
-
setHttpStream
Description copied from interface:HttpChannelSet theHttpStreamto associate to this channel..- Specified by:
setHttpStreamin interfaceHttpChannel- Parameters:
stream- theHttpStreamto associate to this channel.
-
getServer
-
getConnectionMetaData
- Specified by:
getConnectionMetaDatain interfaceHttpChannel- Returns:
- the
ConnectionMetaDataassociated with this channel.
-
getByteBufferPool
- Specified by:
getByteBufferPoolin interfaceComponents- Returns:
- the
ByteBufferPoolassociated with theRequest
-
getScheduler
- Specified by:
getSchedulerin interfaceComponents- Returns:
- the
Schedulerassociated with theRequest
-
getThreadPool
- Specified by:
getThreadPoolin interfaceComponents- Returns:
- the
ThreadPoolassociated with theRequest
-
getExecutor
- Specified by:
getExecutorin interfaceComponents- Returns:
- the
Executorassociated with theRequest
-
getCache
Description copied from interface:ComponentsA 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:
getCachein 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:
onRequestin interfaceHttpChannel- Parameters:
request- The request metadata to handle.- Returns:
- A Runnable that will call
Request.Handler.handle(Request, Response, Callback). Unlike all otherRunnables returned by HttpChannel methods, this runnable should not be mutually excluded or serialized. Specifically otherRunnables returned by methods on this class can be run concurrently with theRunnablereturned from this method.
-
getRequest
Description copied from interface:HttpChannelReturns the
Requestobject, if available.The
Requestobject is only available after a call toHttpChannel.onRequest(MetaData.Request)has been made.- Specified by:
getRequestin interfaceHttpChannel- Returns:
- the
Requestobject, or null if theRequestobject is not yet available.
-
getResponse
-
isRequestHandled
public boolean isRequestHandled()- Specified by:
isRequestHandledin interfaceHttpChannel- Returns:
- whether the request has been passed to the root
Handler.
-
onContentAvailable
Description copied from interface:HttpChannelHttpStreaminvokes this method when more HTTP request content is available.- Specified by:
onContentAvailablein interfaceHttpChannel- Returns:
- the last
Runnablepassed toRequest.demand(Runnable), ornullif there is no demand for content.
-
getInvocationType
- Specified by:
getInvocationTypein interfaceInvocable- Returns:
- The InvocationType of this object
-
onIdleTimeout
Description copied from interface:HttpChannelNotifies this
HttpChannelthat an idle timeout happened.- Specified by:
onIdleTimeoutin interfaceHttpChannel- Parameters:
t- the timeout.- Returns:
- a
Runnablethat performs the timeout action, ornullif no action need be performed by the calling thread - See Also:
-
onFailure
Description copied from interface:HttpChannelNotifies this
HttpChannelthat an asynchronous failure happened.Typical failure examples could be protocol failures (for example, invalid request bytes).
- Specified by:
onFailurein interfaceHttpChannel- Parameters:
x- the failure cause.- Returns:
- a
Runnablethat performs the failure action, ornullif no failure action needs be performed by the calling thread - See Also:
-
onRemoteFailure
Description copied from interface:HttpChannelNotifies this
HttpChannelthat an asynchronous notification was received indicating a remote failure happened.Typical failure examples could be HTTP/2 resets.
- Specified by:
onRemoteFailurein interfaceHttpChannel- Parameters:
x- the failure cause.- Returns:
- a
Runnablethat performs the failure action, ornullif no failure action needs be performed by the calling thread - See Also:
-
onClose
Description copied from interface:HttpChannelNotifies this
HttpChannelthat an asynchronous close happened.- Specified by:
onClosein interfaceHttpChannel- Returns:
- a
Runnablethat performs the close action, ornullif no close action needs be performed by the calling thread
-
addHttpStreamWrapper
-
toString
-