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
ConstructorsConstructorDescriptionHttpChannelOverHTTP2(Connector connector, HttpConfiguration configuration, EndPoint endPoint, HttpTransportOverHTTP2 transport) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidcommit(MetaData.Response info) protected voidvoidcontinue100(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 booleaneof()Mark the channel's input as EOF.booleanfailAllContent(Throwable failure) Fail all content that is currently stored within the channel.booleanFail the channel's input.longGet the idle timeout.protected IStreambooleanbooleanisIdle()booleanbooleanbooleanNotify the channel that content is needed.voidonFlushed(long bytes) Invoked when aWriteFlusherflushed bytes in a non-blocking way, as part of a - possibly larger - write.onPushRequest(MetaData.Request request) onRequest(HeadersFrame frame) booleanonTrailer(HeadersFrame frame) Produce aHttpInput.Contentobject with data currently stored within the channel.voidrecycle()voidsetIdleTimeout(long timeoutMs) Set the idle timeout.voidsetUseOutputDirectByteBuffers(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:
isUseOutputDirectByteBuffersin classHttpChannel
-
setUseOutputDirectByteBuffers
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers) -
isExpecting100Continue
public boolean isExpecting100Continue()- Overrides:
isExpecting100Continuein classHttpChannel
-
setIdleTimeout
public void setIdleTimeout(long timeoutMs) Description copied from class:HttpChannelSet 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:
setIdleTimeoutin classHttpChannel- Parameters:
timeoutMs- the idle timeout in milliseconds
-
getIdleTimeout
public long getIdleTimeout()Description copied from class:HttpChannelGet 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:
getIdleTimeoutin classHttpChannel- Returns:
- the idle timeout (in milliseconds)
-
onFlushed
Description copied from interface:WriteFlusher.ListenerInvoked when a
WriteFlusherflushed 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
IOExceptionto signal that the write should fail, for example if the implementation enforces a minimum data rate.- Specified by:
onFlushedin interfaceWriteFlusher.Listener- Parameters:
bytes- the number of bytes flushed- Throws:
IOException- if the write should fail
-
onRequest
-
onPushRequest
-
getHttpTransport
- Overrides:
getHttpTransportin classHttpChannel
-
recycle
public void recycle()- Overrides:
recyclein classHttpChannel
-
commit
- Overrides:
commitin classHttpChannel
-
onData
- Specified by:
onDatain interfaceHTTP2Channel.Server
-
needContent
public boolean needContent()Description copied from class:HttpChannelNotify 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:
needContentin classHttpChannel- Returns:
- true if content is immediately available.
-
produceContent
Description copied from class:HttpChannelProduce aHttpInput.Contentobject 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:
produceContentin classHttpChannel- Returns:
- a
HttpInput.Contentobject if one is immediately available without blocking, null otherwise.
-
failAllContent
Description copied from class:HttpChannelFail all content that is currently stored within the channel.- Specified by:
failAllContentin 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:HttpChannelFail the channel's input.- Specified by:
failedin classHttpChannel- Parameters:
x- the failure.- Returns:
- true if the channel needs to be rescheduled.
-
eof
protected boolean eof()Description copied from class:HttpChannelMark the channel's input as EOF.- Specified by:
eofin classHttpChannel- Returns:
- true if the channel needs to be rescheduled.
-
onTrailer
- Specified by:
onTrailerin interfaceHTTP2Channel.Server
-
isIdle
public boolean isIdle()- Specified by:
isIdlein interfaceHTTP2Channel.Server
-
onTimeout
- Specified by:
onTimeoutin interfaceHTTP2Channel.Server
-
onFailure
- Specified by:
onFailurein 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:
continue100in 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:
isTunnellingSupportedin classHttpChannel
-
getTunnellingEndPoint
- Overrides:
getTunnellingEndPointin classHttpChannel
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
toString
- Overrides:
toStringin classHttpChannel
-