Top Description Methods
org.apache.hc.core5.http.io

public Interface HttpClientConnection

extends BHttpConnection
Known Direct Implementers
org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
Imports
java.io.IOException, org.apache.hc.core5.http.ClassicHttpRequest, .ClassicHttpResponse, .HttpException

A client-side HTTP connection, which can be used for sending requests and receiving responses.
Since
4.0

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the connection is known to be in a inconsistent state and cannot be re-used.
isConsistent
()

Checks whether this connection is in a consistent state.

public void
receiveResponseEntity(ClassicHttpResponse
the response to attach the entity to
response
)

Receives the next response entity available from this connection and attaches it to an existing HttpResponse object.

public ClassicHttpResponse

Returns:

a new HttpResponse object with status line and headers initialized or null if the connection has been closed by the opposite endpoint.
receiveResponseHeader
()

Receives the request line and headers of the next response available from this connection.

public void
sendRequestEntity(ClassicHttpRequest
the request whose entity to send.
request
)

Sends the request entity over the connection.

public void
sendRequestHeader(ClassicHttpRequest
the request whose headers to send.
request
)

Sends the request line and all headers over the connection.

public void
terminateRequest(ClassicHttpRequest
the request to be terminated prematurely.
request
)

Terminates request prematurely potentially leaving the connection in a inconsistent state.

Inherited from org.apache.hc.core5.http.io.BHttpConnection:
flushisDataAvailableisStale

Method Detail

isConsistentback to summary
public boolean isConsistent()

Checks whether this connection is in a consistent state.

Returns:boolean

true if the connection is known to be in a inconsistent state and cannot be re-used.

Since
5.0
See Also
terminateRequest(ClassicHttpRequest)
receiveResponseEntityback to summary
public void receiveResponseEntity(ClassicHttpResponse response) throws HttpException, IOException

Receives the next response entity available from this connection and attaches it to an existing HttpResponse object.

Parameters
response:ClassicHttpResponse

the response to attach the entity to

Exceptions
HttpException:
in case of HTTP protocol violation
IOException:
in case of an I/O error
receiveResponseHeaderback to summary
public ClassicHttpResponse receiveResponseHeader() throws HttpException, IOException

Receives the request line and headers of the next response available from this connection. The caller should examine the HttpResponse object to find out if it should try to receive a response entity as well.

Returns:ClassicHttpResponse

a new HttpResponse object with status line and headers initialized or null if the connection has been closed by the opposite endpoint.

Exceptions
HttpException:
in case of HTTP protocol violation
IOException:
in case of an I/O error
sendRequestEntityback to summary
public void sendRequestEntity(ClassicHttpRequest request) throws HttpException, IOException

Sends the request entity over the connection.

Parameters
request:ClassicHttpRequest

the request whose entity to send.

Exceptions
HttpException:
in case of HTTP protocol violation
IOException:
in case of an I/O error
sendRequestHeaderback to summary
public void sendRequestHeader(ClassicHttpRequest request) throws HttpException, IOException

Sends the request line and all headers over the connection.

Parameters
request:ClassicHttpRequest

the request whose headers to send.

Exceptions
HttpException:
in case of HTTP protocol violation
IOException:
in case of an I/O error
terminateRequestback to summary
public void terminateRequest(ClassicHttpRequest request) throws HttpException, IOException

Terminates request prematurely potentially leaving the connection in a inconsistent state.

Parameters
request:ClassicHttpRequest

the request to be terminated prematurely.

Since
5.0
See Also
isConsistent()