public final class Http2ExchangeCodec extends java.lang.Object implements ExchangeCodec
Modifier and Type | Field and Description |
---|---|
private boolean |
canceled |
private Interceptor.Chain |
chain |
private Http2Connection |
connection |
private static java.lang.String |
CONNECTION |
private static java.lang.String |
ENCODING |
private static java.lang.String |
HOST |
private static java.util.List<java.lang.String> |
HTTP_2_SKIPPED_REQUEST_HEADERS
See http://tools.ietf.org/html/draft-ietf-httpbis-http2-09#section-8.1.3.
|
private static java.util.List<java.lang.String> |
HTTP_2_SKIPPED_RESPONSE_HEADERS |
private static java.lang.String |
KEEP_ALIVE |
private Protocol |
protocol |
private static java.lang.String |
PROXY_CONNECTION |
private RealConnection |
realConnection |
private Http2Stream |
stream |
private static java.lang.String |
TE |
private static java.lang.String |
TRANSFER_ENCODING |
private static java.lang.String |
UPGRADE |
DISCARD_STREAM_TIMEOUT_MILLIS
Constructor and Description |
---|
Http2ExchangeCodec(OkHttpClient client,
RealConnection realConnection,
Interceptor.Chain chain,
Http2Connection connection) |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancel this stream.
|
RealConnection |
connection()
Returns the connection that carries this codec.
|
okio.Sink |
createRequestBody(Request request,
long contentLength)
Returns an output stream where the request body can be streamed.
|
void |
finishRequest()
Flush the request to the underlying socket and signal no more bytes will be transmitted.
|
void |
flushRequest()
Flush the request to the underlying socket.
|
static java.util.List<Header> |
http2HeadersList(Request request) |
okio.Source |
openResponseBodySource(Response response) |
static Response.Builder |
readHttp2HeadersList(Headers headerBlock,
Protocol protocol)
Returns headers for a name value block containing an HTTP/2 response.
|
Response.Builder |
readResponseHeaders(boolean expectContinue)
Parses bytes of a response header from an HTTP transport.
|
long |
reportedContentLength(Response response) |
Headers |
trailers()
Returns the trailers after the HTTP response.
|
void |
writeRequestHeaders(Request request)
This should update the HTTP engine's sentRequestMillis field.
|
private static final java.lang.String CONNECTION
private static final java.lang.String HOST
private static final java.lang.String KEEP_ALIVE
private static final java.lang.String PROXY_CONNECTION
private static final java.lang.String TRANSFER_ENCODING
private static final java.lang.String TE
private static final java.lang.String ENCODING
private static final java.lang.String UPGRADE
private static final java.util.List<java.lang.String> HTTP_2_SKIPPED_REQUEST_HEADERS
private static final java.util.List<java.lang.String> HTTP_2_SKIPPED_RESPONSE_HEADERS
private final Interceptor.Chain chain
private final RealConnection realConnection
private final Http2Connection connection
private volatile Http2Stream stream
private final Protocol protocol
private volatile boolean canceled
public Http2ExchangeCodec(OkHttpClient client, RealConnection realConnection, Interceptor.Chain chain, Http2Connection connection)
public RealConnection connection()
ExchangeCodec
connection
in interface ExchangeCodec
public okio.Sink createRequestBody(Request request, long contentLength)
ExchangeCodec
createRequestBody
in interface ExchangeCodec
public void writeRequestHeaders(Request request) throws java.io.IOException
ExchangeCodec
writeRequestHeaders
in interface ExchangeCodec
java.io.IOException
public void flushRequest() throws java.io.IOException
ExchangeCodec
flushRequest
in interface ExchangeCodec
java.io.IOException
public void finishRequest() throws java.io.IOException
ExchangeCodec
finishRequest
in interface ExchangeCodec
java.io.IOException
public Response.Builder readResponseHeaders(boolean expectContinue) throws java.io.IOException
ExchangeCodec
readResponseHeaders
in interface ExchangeCodec
expectContinue
- true to return null if this is an intermediate response with a "100"
response code. Otherwise this method never returns null.java.io.IOException
public static Response.Builder readHttp2HeadersList(Headers headerBlock, Protocol protocol) throws java.io.IOException
java.io.IOException
public long reportedContentLength(Response response)
reportedContentLength
in interface ExchangeCodec
public okio.Source openResponseBodySource(Response response)
openResponseBodySource
in interface ExchangeCodec
public Headers trailers() throws java.io.IOException
ExchangeCodec
trailers
in interface ExchangeCodec
java.io.IOException
public void cancel()
ExchangeCodec
cancel
in interface ExchangeCodec