public class HttpChannelOverHTTP2 extends HttpChannel implements java.io.Closeable, WriteFlusher.Listener
Modifier and Type | Class and Description |
---|---|
private class |
HttpChannelOverHTTP2.FailureTask |
HttpChannel.Listener
Modifier and Type | Field and Description |
---|---|
private boolean |
_delayedUntilContent |
private boolean |
_expect100Continue |
private static Logger |
LOG |
private static HttpField |
POWERED_BY |
private static HttpField |
SERVER_VERSION |
Constructor and Description |
---|
HttpChannelOverHTTP2(Connector connector,
HttpConfiguration configuration,
EndPoint endPoint,
HttpTransportOverHTTP2 transport) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
commit(MetaData.Response info) |
protected void |
consumeInput() |
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.
|
HttpTransportOverHTTP2 |
getHttpTransport() |
long |
getIdleTimeout()
Get the idle timeout.
|
protected IStream |
getStream() |
private void |
handleWithContext() |
boolean |
isExpecting100Continue() |
boolean |
isRequestIdle() |
java.lang.Runnable |
onFailure(java.lang.Throwable failure,
Callback callback) |
void |
onFlushed(long bytes)
Invoked when a
WriteFlusher flushed bytes in a non-blocking way,
as part of a - possibly larger - write. |
java.lang.Runnable |
onPushRequest(MetaData.Request request) |
java.lang.Runnable |
onRequest(HeadersFrame frame) |
java.lang.Runnable |
onRequestContent(DataFrame frame,
Callback callback) |
java.lang.Runnable |
onRequestTrailers(HeadersFrame frame) |
boolean |
onStreamTimeout(java.lang.Throwable failure,
java.util.function.Consumer<java.lang.Runnable> consumer) |
void |
recycle() |
void |
setIdleTimeout(long timeoutMs)
Set the idle timeout.
|
java.lang.String |
toString() |
abort, addListener, addRequestLog, execute, getByteBufferPool, getBytesWritten, getCommittedMetaData, getConnection, getConnector, getEndPoint, getHttpConfiguration, getLocalAddress, getNextInterceptor, getRemoteAddress, getRequest, getRequestLog, getRequests, getResponse, getScheduler, getServer, getState, handle, handleException, isCommitted, isExpecting102Processing, isOptimizedForDirectBuffers, isPersistent, isRequestCompleted, isResponseCompleted, newHttpInput, newHttpOutput, onAsyncWaitForContent, onBadMessage, onBlockWaitForContent, onBlockWaitForContentFailure, onCompleted, onContent, onContentComplete, onEarlyEOF, onRequest, onRequestComplete, onTrailers, removeListener, resetBuffer, run, sendError, sendResponse, sendResponse, setRequestLog, unwrap, useDirectBuffers, write
private static final Logger LOG
private static final HttpField SERVER_VERSION
private static final HttpField POWERED_BY
private boolean _expect100Continue
private boolean _delayedUntilContent
public HttpChannelOverHTTP2(Connector connector, HttpConfiguration configuration, EndPoint endPoint, HttpTransportOverHTTP2 transport)
protected IStream getStream()
public boolean isExpecting100Continue()
isExpecting100Continue
in class HttpChannel
public void setIdleTimeout(long timeoutMs)
HttpChannel
This is implemented as a call to EndPoint.setIdleTimeout(long)
, but may be
overridden by channels that have timeouts different from their connections.
setIdleTimeout
in class HttpChannel
timeoutMs
- the idle timeout in millisecondspublic long getIdleTimeout()
HttpChannel
This is implemented as a call to EndPoint.getIdleTimeout()
, but may be
overridden by channels that have timeouts different from their connections.
getIdleTimeout
in class HttpChannel
public void onFlushed(long bytes) throws java.io.IOException
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.
onFlushed
in interface WriteFlusher.Listener
bytes
- the number of bytes flushedjava.io.IOException
- if the write should failpublic java.lang.Runnable onRequest(HeadersFrame frame)
public java.lang.Runnable onPushRequest(MetaData.Request request)
public HttpTransportOverHTTP2 getHttpTransport()
getHttpTransport
in class HttpChannel
public void recycle()
recycle
in class HttpChannel
protected void commit(MetaData.Response info)
commit
in class HttpChannel
public java.lang.Runnable onRequestTrailers(HeadersFrame frame)
public boolean isRequestIdle()
public boolean onStreamTimeout(java.lang.Throwable failure, java.util.function.Consumer<java.lang.Runnable> consumer)
public java.lang.Runnable onFailure(java.lang.Throwable failure, Callback callback)
protected void consumeInput()
private void handleWithContext()
public void continue100(int available) throws java.io.IOException
continue100
in class HttpChannel
available
- estimate of the number of bytes that are availablejava.io.IOException
- if the InputStream cannot be createdpublic void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public java.lang.String toString()
toString
in class HttpChannel