- All Superinterfaces:
org.eclipse.jetty.util.thread.Invocable
Represents the state of an HTTP request/response cycle.
HttpChannel links the lower (closer to the network) layer HttpStream
with the upper (application code) layer Handler.
An HttpChannel instance may be used for many HTTP request/response cycles
from the same connection; however, only a single cycle may be active at any time.
Default implementations of this interface may be created via HttpChannel.DefaultFactory.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classThe factory that creates default implementations ofHttpChannel.static interfaceA factory forHttpChannelinstances.Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
org.eclipse.jetty.util.thread.Invocable.Callable, org.eclipse.jetty.util.thread.Invocable.InvocationType, org.eclipse.jetty.util.thread.Invocable.ReadyTask, org.eclipse.jetty.util.thread.Invocable.Task -
Field Summary
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking, NOOP -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpChannelorg.eclipse.jetty.http.ComplianceViolation.ListenerReturns theRequestobject, if available.voidInitialize the HttpChannel when a new cycle of request handling begins.booleanHttpStreaminvokes this method when more HTTP request content is available.Notifies thisHttpChannelthat an asynchronous failure happened.onIdleTimeout(TimeoutException idleTimeout) Notifies thisHttpChannelthat an idle timeout happened.onRequest(org.eclipse.jetty.http.MetaData.Request metaData) HttpStreaminvokes this method when the metadata of an HTTP request (method, URI and headers, but not content) has been parsed.voidrecycle()Recycle the HttpChannel, so that a new cycle of callingsetHttpStream(HttpStream),onRequest(MetaData.Request)etc.voidsetHttpStream(HttpStream httpStream) Set theHttpStreamto associate to this channel..Methods inherited from interface org.eclipse.jetty.util.thread.Invocable
getInvocationType
-
Method Details
-
getConnectionMetaData
ConnectionMetaData getConnectionMetaData()- Returns:
- the
ConnectionMetaDataassociated with this channel.
-
setHttpStream
Set theHttpStreamto associate to this channel..- Parameters:
httpStream- theHttpStreamto associate to this channel.
-
isRequestHandled
boolean isRequestHandled()- Returns:
- whether the request has been passed to the root
Handler.
-
onRequest
HttpStreaminvokes this method when the metadata of an HTTP request (method, URI and headers, but not content) has been parsed.The returned
Runnableinvokes the rootHandler.- Parameters:
metaData- the HTTP request metadata.- Returns:
- a
Runnablethat invokes the rootHandler.
-
getRequest
Request getRequest()Returns the
Requestobject, if available.The
Requestobject is only available after a call toonRequest(MetaData.Request)has been made.- Returns:
- the
Requestobject, or null if theRequestobject is not yet available.
-
onContentAvailable
Runnable onContentAvailable()HttpStreaminvokes this method when more HTTP request content is available.- Returns:
- the last
Runnablepassed toRequest.demand(Runnable), ornullif there is no demand for content.
-
onIdleTimeout
Notifies this
HttpChannelthat an idle timeout happened.- Parameters:
idleTimeout- the timeout.- Returns:
- a
Runnablethat performs the timeout action, ornullif no action need be performed by the calling thread - See Also:
-
onFailure
Notifies this
HttpChannelthat an asynchronous failure happened.Typical failure examples could be HTTP/2 resets or protocol failures (for example, invalid request bytes).
- Parameters:
failure- the failure cause.- Returns:
- a
Runnablethat performs the failure action, ornullif no failure action need be performed by the calling thread - See Also:
-
recycle
void recycle()Recycle the HttpChannel, so that a new cycle of callingsetHttpStream(HttpStream),onRequest(MetaData.Request)etc. may be performed on the channel.- See Also:
-
initialize
void initialize()Initialize the HttpChannel when a new cycle of request handling begins.- See Also:
-
getComplianceViolationListener
org.eclipse.jetty.http.ComplianceViolation.Listener getComplianceViolationListener()- Returns:
- the active
ComplianceViolation.Listener
-
from
- Parameters:
request- attempt to resolve the HttpChannel from the provided request- Returns:
- the HttpChannel if found
- Throws:
IllegalStateException- if unable to find HttpChannel
-