DISCARD_STREAM_TIMEOUT_MILLIS
Constructor and Description |
---|
HttpTransport(HttpEngine httpEngine,
HttpConnection httpConnection) |
Modifier and Type | Method and Description |
---|---|
boolean |
canReuseConnection()
Returns true if the socket connection held by this transport can be reused
for a follow-up exchange.
|
okio.Sink |
createRequestBody(Request request,
long contentLength)
Returns an output stream where the request body can be streamed.
|
void |
disconnect(HttpEngine engine) |
void |
finishRequest()
Flush the request to the underlying socket.
|
ResponseBody |
openResponseBody(Response response)
Returns a stream that reads the response body.
|
Response.Builder |
readResponseHeaders()
Read and return response headers.
|
void |
releaseConnectionOnIdle()
Configures the response body to pool or close the socket connection when
the response body is closed.
|
void |
writeRequestBody(RetryableSink requestBody)
Sends the request body returned by
Transport.createRequestBody(com.squareup.okhttp.Request, long) to the
remote peer. |
void |
writeRequestHeaders(Request request)
Prepares the HTTP headers and sends them to the server.
|
public HttpTransport(HttpEngine httpEngine, HttpConnection httpConnection)
public okio.Sink createRequestBody(Request request, long contentLength) throws IOException
Transport
createRequestBody
in interface Transport
IOException
public void finishRequest() throws IOException
Transport
finishRequest
in interface Transport
IOException
public void writeRequestBody(RetryableSink requestBody) throws IOException
Transport
Transport.createRequestBody(com.squareup.okhttp.Request, long)
to the
remote peer.writeRequestBody
in interface Transport
IOException
public void writeRequestHeaders(Request request) throws IOException
For streaming requests with a body, headers must be prepared before the output stream has been written to. Otherwise the body would need to be buffered!
For non-streaming requests with a body, headers must be prepared
after the output stream has been written to and closed.
This ensures that the Content-Length
header field receives the
proper value.
writeRequestHeaders
in interface Transport
IOException
public Response.Builder readResponseHeaders() throws IOException
Transport
readResponseHeaders
in interface Transport
IOException
public void releaseConnectionOnIdle() throws IOException
Transport
releaseConnectionOnIdle
in interface Transport
IOException
public boolean canReuseConnection()
Transport
canReuseConnection
in interface Transport
public ResponseBody openResponseBody(Response response) throws IOException
Transport
openResponseBody
in interface Transport
IOException
public void disconnect(HttpEngine engine) throws IOException
disconnect
in interface Transport
IOException
Copyright © 2015. All rights reserved.