Class HttpChannelOverHTTP2
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Runnable
,HTTP2Channel.Server
,WriteFlusher.Listener
,HttpOutput.Interceptor
- Direct Known Subclasses:
HTTP2ServerConnection.ServerHttpChannelOverHTTP2
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.server.HttpChannel
HttpChannel.Listener, HttpChannel.TransientListeners
-
Field Summary
Fields inherited from class org.eclipse.jetty.server.HttpChannel
NOOP_LISTENER
-
Constructor Summary
ConstructorDescriptionHttpChannelOverHTTP2
(Connector connector, HttpConfiguration configuration, EndPoint endPoint, HttpTransportOverHTTP2 transport) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected void
commit
(MetaData.Response info) protected void
void
continue100
(int available) If the associated response has the Expect header set to 100 Continue, then accessing the input stream indicates that the handler/servlet is ready for the request body and thus a 100 Continue response is sent.protected boolean
eof()
Mark the channel's input as EOF.boolean
failAllContent
(Throwable failure) Fail all content that is currently stored within the channel.boolean
Fail the channel's input.long
Get the idle timeout.protected IStream
boolean
boolean
isIdle()
boolean
boolean
boolean
Notify the channel that content is needed.void
onFlushed
(long bytes) Invoked when aWriteFlusher
flushed bytes in a non-blocking way, as part of a - possibly larger - write.onPushRequest
(MetaData.Request request) onRequest
(HeadersFrame frame) boolean
onTrailer
(HeadersFrame frame) Produce aHttpInput.Content
object with data currently stored within the channel.void
recycle()
void
setIdleTimeout
(long timeoutMs) Set the idle timeout.void
setUseOutputDirectByteBuffers
(boolean useOutputDirectByteBuffers) toString()
Methods inherited from class org.eclipse.jetty.server.HttpChannel
abort, addListener, addRequestLog, checkAndPrepareUpgrade, ensureConsumeAllOrNotPersistent, execute, formatAddrOrHost, getByteBufferPool, getBytesWritten, getCommittedMetaData, getConnection, getConnector, getEndPoint, getHttpConfiguration, getLocalAddress, getLocalName, getLocalPort, getNextInterceptor, getRemoteAddress, getRequest, getRequestLog, getRequests, getResponse, getScheduler, getServer, getServerAuthority, getState, getTransientListeners, handle, handleException, isCommitted, isExpecting102Processing, isPersistent, isRequestCompleted, isResponseCompleted, isSendError, isUseInputDirectByteBuffers, newHttpOutput, onBadMessage, onCompleted, onContent, onContentComplete, onRequest, onRequestComplete, onTrailers, removeListener, resetBuffer, run, sendErrorOrAbort, sendResponse, sendResponse, sendResponseAndComplete, setRequestLog, unwrap, write
-
Constructor Details
-
HttpChannelOverHTTP2
public HttpChannelOverHTTP2(Connector connector, HttpConfiguration configuration, EndPoint endPoint, HttpTransportOverHTTP2 transport)
-
-
Method Details
-
getStream
-
isUseOutputDirectByteBuffers
public boolean isUseOutputDirectByteBuffers()- Overrides:
isUseOutputDirectByteBuffers
in classHttpChannel
-
setUseOutputDirectByteBuffers
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers) -
isExpecting100Continue
public boolean isExpecting100Continue()- Overrides:
isExpecting100Continue
in classHttpChannel
-
setIdleTimeout
public void setIdleTimeout(long timeoutMs) Description copied from class:HttpChannel
Set the idle timeout.This is implemented as a call to
EndPoint.setIdleTimeout(long)
, but may be overridden by channels that have timeouts different from their connections.- Overrides:
setIdleTimeout
in classHttpChannel
- Parameters:
timeoutMs
- the idle timeout in milliseconds
-
getIdleTimeout
public long getIdleTimeout()Description copied from class:HttpChannel
Get the idle timeout.This is implemented as a call to
EndPoint.getIdleTimeout()
, but may be overridden by channels that have timeouts different from their connections.- Overrides:
getIdleTimeout
in classHttpChannel
- Returns:
- the idle timeout (in milliseconds)
-
onFlushed
Description copied from interface:WriteFlusher.Listener
Invoked when a
WriteFlusher
flushed bytes in a non-blocking way, as part of a - possibly larger - write.This method may be invoked multiple times, for example when writing a large buffer: a first flush of bytes, then the connection became TCP congested, and a subsequent flush of bytes when the connection became writable again.
This method is never invoked concurrently, but may be invoked by different threads, so implementations may not rely on thread-local variables.
Implementations may throw an
IOException
to signal that the write should fail, for example if the implementation enforces a minimum data rate.- Specified by:
onFlushed
in interfaceWriteFlusher.Listener
- Parameters:
bytes
- the number of bytes flushed- Throws:
IOException
- if the write should fail
-
onRequest
-
onPushRequest
-
getHttpTransport
- Overrides:
getHttpTransport
in classHttpChannel
-
recycle
public void recycle()- Overrides:
recycle
in classHttpChannel
-
commit
- Overrides:
commit
in classHttpChannel
-
onData
- Specified by:
onData
in interfaceHTTP2Channel.Server
-
needContent
public boolean needContent()Description copied from class:HttpChannel
Notify the channel that content is needed. If some content is immediately available, true is returned andHttpChannel.produceContent()
has to be called and will return a non-null object. If no content is immediately available, an attempt to produce content must be made; if new content has been produced, true is returned; otherwiseHttpInput.onContentProducible()
is called once some content arrives andHttpChannel.produceContent()
can be called without returningnull
. If a failure happens, thenHttpInput.onContentProducible()
will be called and an error content will return the error on the next call toHttpChannel.produceContent()
.- Specified by:
needContent
in classHttpChannel
- Returns:
- true if content is immediately available.
-
produceContent
Description copied from class:HttpChannel
Produce aHttpInput.Content
object with data currently stored within the channel. The produced content can be special (meaning callingHttpInput.Content.isSpecial()
returns true) if the channel reached a special state, like EOF or an error. Once a special content has been returned, all subsequent calls to this method will always return a special content of the same kind andHttpChannel.needContent()
will always return true. The returned content is "raw", i.e.: not decoded.- Specified by:
produceContent
in classHttpChannel
- Returns:
- a
HttpInput.Content
object if one is immediately available without blocking, null otherwise.
-
failAllContent
Description copied from class:HttpChannel
Fail all content that is currently stored within the channel.- Specified by:
failAllContent
in classHttpChannel
- Parameters:
failure
- the failure to fail the content with.- Returns:
- true if EOF was reached while failing all content, false otherwise.
-
failed
Description copied from class:HttpChannel
Fail the channel's input.- Specified by:
failed
in classHttpChannel
- Parameters:
x
- the failure.- Returns:
- true if the channel needs to be rescheduled.
-
eof
protected boolean eof()Description copied from class:HttpChannel
Mark the channel's input as EOF.- Specified by:
eof
in classHttpChannel
- Returns:
- true if the channel needs to be rescheduled.
-
onTrailer
- Specified by:
onTrailer
in interfaceHTTP2Channel.Server
-
isIdle
public boolean isIdle()- Specified by:
isIdle
in interfaceHTTP2Channel.Server
-
onTimeout
- Specified by:
onTimeout
in interfaceHTTP2Channel.Server
-
onFailure
- Specified by:
onFailure
in interfaceHTTP2Channel.Server
-
consumeInput
protected void consumeInput() -
continue100
If the associated response has the Expect header set to 100 Continue, then accessing the input stream indicates that the handler/servlet is ready for the request body and thus a 100 Continue response is sent.- Overrides:
continue100
in classHttpChannel
- Parameters:
available
- estimate of the number of bytes that are available- Throws:
IOException
- if the InputStream cannot be created
-
isTunnellingSupported
public boolean isTunnellingSupported()- Overrides:
isTunnellingSupported
in classHttpChannel
-
getTunnellingEndPoint
- Overrides:
getTunnellingEndPoint
in classHttpChannel
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
toString
- Overrides:
toString
in classHttpChannel
-