Top Description Inners Fields Methods
org.eclipse.jetty.server

public Interface HttpChannel

extends Invocable
Known Direct Implementers
org.eclipse.jetty.server.internal.HttpChannelState
Imports
java.util.concurrent.TimeoutException, java.util.function.Consumer, .Predicate, org.eclipse.jetty.http.ComplianceViolation, .MetaData, org.eclipse.jetty.server.internal.HttpChannelState, 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 DefaultFactory.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
HttpChannel.DefaultFactory

The factory that creates default implementations of HttpChannel.

public static interface
HttpChannel.Factory

A factory for HttpChannel instances.

Field Summary

Inherited from org.eclipse.jetty.util.thread.Invocable:
__nonBlockingNOOP

Method Summary

Modifier and TypeMethod and Description
public static HttpChannel

Returns:

the HttpChannel if found
from
(Request
attempt to resolve the HttpChannel from the provided request
request
)

public ComplianceViolation.Listener
public ConnectionMetaData

Returns:

the ConnectionMetaData associated with this channel.
getConnectionMetaData
()

public Request

Returns:

the Request object, or null if the Request object is not yet available.
getRequest
()

Returns the Request object, if available.

public void
initialize()

Initialize the HttpChannel when a new cycle of request handling begins.

public boolean

Returns:

whether the request has been passed to the root Handler.
isRequestHandled
()

public Runnable

Returns:

the last Runnable passed to Request#demand(Runnable), or null if there is no demand for content.
onContentAvailable
()

HttpStream invokes this method when more HTTP request content is available.

public Runnable

Returns:

a Runnable that performs the failure action, or null if no failure action need be performed by the calling thread
onFailure
(Throwable
the failure cause.
failure
)

Notifies this HttpChannel that an asynchronous failure happened.

public Runnable

Returns:

a Runnable that performs the timeout action, or null if no action need be performed by the calling thread
onIdleTimeout
(TimeoutException
the timeout.
idleTimeout
)

Notifies this HttpChannel that an idle timeout happened.

public Runnable

Returns:

a Runnable that invokes the root Handler.
onRequest
(MetaData.Request
the HTTP request metadata.
metaData
)

HttpStream invokes this method when the metadata of an HTTP request (method, URI and headers, but not content) has been parsed.

public void
recycle()

Recycle the HttpChannel, so that a new cycle of calling setHttpStream(HttpStream), onRequest(MetaData.Request) etc. may be performed on the channel.

public void
setHttpStream(HttpStream
the HttpStream to associate to this channel.
httpStream
)

Set the HttpStream to associate to this channel..

Inherited from org.eclipse.jetty.util.thread.Invocable:
combinecombinefromgetInvocationTypegetInvocationTypeinvokeNonBlockingisNonBlockingInvocation

Method Detail

fromback to summary
public static HttpChannel from(Request request)
Parameters
request:Request

attempt to resolve the HttpChannel from the provided request

Returns:HttpChannel

the HttpChannel if found

Exceptions
IllegalStateException:
if unable to find HttpChannel
getComplianceViolationListenerback to summary
public ComplianceViolation.Listener getComplianceViolationListener()
Returns:ComplianceViolation.Listener

the active ComplianceViolation.Listener

getConnectionMetaDataback to summary
public ConnectionMetaData getConnectionMetaData()
Returns:ConnectionMetaData

the ConnectionMetaData associated with this channel.

getRequestback to summary
public Request getRequest()

Returns the Request object, if available.

The Request object is only available after a call to onRequest(MetaData.Request) has been made.

Returns:Request

the Request object, or null if the Request object is not yet available.

initializeback to summary
public void initialize()

Initialize the HttpChannel when a new cycle of request handling begins.

See Also
recycle()
isRequestHandledback to summary
public boolean isRequestHandled()
Returns:boolean

whether the request has been passed to the root Handler.

onContentAvailableback to summary
public Runnable onContentAvailable()

HttpStream invokes this method when more HTTP request content is available.

Returns:Runnable

the last Runnable passed to Request#demand(Runnable), or null if there is no demand for content.

onFailureback to summary
public Runnable onFailure(Throwable failure)

Notifies this HttpChannel that an asynchronous failure happened.

Typical failure examples could be HTTP/2 resets or protocol failures (for example, invalid request bytes).

Parameters
failure:Throwable

the failure cause.

Returns:Runnable

a Runnable that performs the failure action, or null if no failure action need be performed by the calling thread

See Also
Request#addFailureListener(Consumer)
onIdleTimeoutback to summary
public Runnable onIdleTimeout(TimeoutException idleTimeout)

Notifies this HttpChannel that an idle timeout happened.

Parameters
idleTimeout:TimeoutException

the timeout.

Returns:Runnable

a Runnable that performs the timeout action, or null if no action need be performed by the calling thread

See Also
Request#addIdleTimeoutListener(Predicate)
onRequestback to summary
public Runnable onRequest(MetaData.Request metaData)

HttpStream invokes this method when the metadata of an HTTP request (method, URI and headers, but not content) has been parsed.

The returned Runnable invokes the root Handler.

Parameters
metaData:MetaData.Request

the HTTP request metadata.

Returns:Runnable

a Runnable that invokes the root Handler.

recycleback to summary
public void recycle()

Recycle the HttpChannel, so that a new cycle of calling setHttpStream(HttpStream), onRequest(MetaData.Request) etc. may be performed on the channel.

See Also
initialize()
setHttpStreamback to summary
public void setHttpStream(HttpStream httpStream)

Set the HttpStream to associate to this channel..

Parameters
httpStream:HttpStream

the HttpStream to associate to this channel.

org.eclipse.jetty.server back to summary

public Class HttpChannel.DefaultFactory

extends Object
implements Factory
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.server.HttpChannel.Factory

The factory that creates default implementations of HttpChannel.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public HttpChannel
newHttpChannel(ConnectionMetaData
the ConnectionMetaData associated with the channel.
connectionMetaData
)

Implements org.eclipse.jetty.server.HttpChannel.Factory.newHttpChannel.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

DefaultFactoryback to summary
public DefaultFactory()

Method Detail

newHttpChannelback to summary
public HttpChannel newHttpChannel(ConnectionMetaData connectionMetaData)

Implements org.eclipse.jetty.server.HttpChannel.Factory.newHttpChannel.

Parameters
connectionMetaData:ConnectionMetaData

Doc from org.eclipse.jetty.server.HttpChannel.Factory.newHttpChannel.

the ConnectionMetaData associated with the channel.

Returns:HttpChannel

Doc from org.eclipse.jetty.server.HttpChannel.Factory.newHttpChannel.

a new HttpChannel instance.

Annotations
@Override
org.eclipse.jetty.server back to summary

public Interface HttpChannel.Factory

Known Direct Implementers
org.eclipse.jetty.server.HttpChannel.DefaultFactory

A factory for HttpChannel instances.

See Also
DefaultFactory

Method Summary

Modifier and TypeMethod and Description
public HttpChannel

Returns:

a new HttpChannel instance.
newHttpChannel
(ConnectionMetaData
the ConnectionMetaData associated with the channel.
connectionMetaData
)

Method Detail

newHttpChannelback to summary
public HttpChannel newHttpChannel(ConnectionMetaData connectionMetaData)
Parameters
connectionMetaData:ConnectionMetaData

the ConnectionMetaData associated with the channel.

Returns:HttpChannel

a new HttpChannel instance.