-
- All Implemented Interfaces:
-
com.mobwith.httpmodule.internal.http.HttpCodec
public final class Http2Codec implements HttpCodec
Encode requests and responses using HTTP/2 frames.
-
-
Constructor Summary
Constructors Constructor Description Http2Codec(MobonOkHttpClient client, Interceptor.Chain chain, StreamAllocation streamAllocation, Http2Connection connection)
-
Method Summary
Modifier and Type Method Description SinkcreateRequestBody(MobonRequest mobonRequest, long contentLength)Returns an output stream where the mobonRequest body can be streamed. voidwriteRequestHeaders(MobonRequest mobonRequest)This should update the HTTP engine's sentRequestMillis field. voidflushRequest()Flush the request to the underlying socket. voidfinishRequest()Flush the request to the underlying socket and signal no more bytes will be transmitted. MobonResponse.BuilderreadResponseHeaders(boolean expectContinue)Parses bytes of a response header from an HTTP transport. static List<Header>http2HeadersList(MobonRequest mobonRequest)static MobonResponse.BuilderreadHttp2HeadersList(List<Header> headerBlock, Protocol protocol)Returns headers for a name value block containing an HTTP/2 response. ResponseBodyopenResponseBody(MobonResponse mobonResponse)Returns a stream that reads the mobonResponse body. voidcancel()Cancel this stream. -
-
Constructor Detail
-
Http2Codec
Http2Codec(MobonOkHttpClient client, Interceptor.Chain chain, StreamAllocation streamAllocation, Http2Connection connection)
-
-
Method Detail
-
createRequestBody
Sink createRequestBody(MobonRequest mobonRequest, long contentLength)
Returns an output stream where the mobonRequest body can be streamed.
-
writeRequestHeaders
void writeRequestHeaders(MobonRequest mobonRequest)
This should update the HTTP engine's sentRequestMillis field.
-
flushRequest
void flushRequest()
Flush the request to the underlying socket.
-
finishRequest
void finishRequest()
Flush the request to the underlying socket and signal no more bytes will be transmitted.
-
readResponseHeaders
MobonResponse.Builder readResponseHeaders(boolean expectContinue)
Parses bytes of a response header from an HTTP transport.
- Parameters:
expectContinue- true to return null if this is an intermediate response with a "100"response code.
-
http2HeadersList
static List<Header> http2HeadersList(MobonRequest mobonRequest)
-
readHttp2HeadersList
static MobonResponse.Builder readHttp2HeadersList(List<Header> headerBlock, Protocol protocol)
Returns headers for a name value block containing an HTTP/2 response.
-
openResponseBody
ResponseBody openResponseBody(MobonResponse mobonResponse)
Returns a stream that reads the mobonResponse body.
-
cancel
void cancel()
Cancel this stream. Resources held by this stream will be cleaned up, though not synchronously.That may happen later by the connection pool thread.
-
-
-
-