public class LoggingBHttpClientConnection extends DefaultBHttpClientConnection implements Identifiable
| Constructor and Description |
|---|
LoggingBHttpClientConnection(Http1Config http1Config) |
LoggingBHttpClientConnection(Http1Config http1Config,
CharsetDecoder charDecoder,
CharsetEncoder charEncoder,
ContentLengthStrategy incomingContentStrategy,
ContentLengthStrategy outgoingContentStrategy,
HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory,
HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
awaitInput(Timeout timeout) |
void |
bind(Socket socket)
Binds this connection to the given
Socket. |
protected void |
bind(SocketHolder socketHolder) |
void |
close()
Closes this connection gracefully.
|
void |
close(CloseMode closeMode)
Closes this process or endpoint and releases any system resources associated
with it.
|
protected InputStream |
createContentInputStream(long len,
SessionInputBuffer buffer,
InputStream inputStream) |
protected OutputStream |
createContentOutputStream(long len,
SessionOutputBuffer buffer,
OutputStream outputStream,
Supplier<List<? extends Header>> trailers) |
protected SocketHolder |
ensureOpen() |
void |
flush()
Writes out all pending buffered data over the open connection.
|
EndpointDetails |
getEndpointDetails()
Returns this connection's endpoint details.
|
String |
getId() |
SocketAddress |
getLocalAddress()
Returns this connection's local address or
null if it is not bound yet. |
ProtocolVersion |
getProtocolVersion()
Returns this connection's protocol version or
null if unknown. |
SocketAddress |
getRemoteAddress()
Returns this connection's remote address or
null if it is not connected yet or
unconnected. |
protected SocketHolder |
getSocketHolder() |
Timeout |
getSocketTimeout()
Returns the socket timeout value.
|
SSLSession |
getSSLSession()
Returns this connection's SSL session or
null if TLS has not been activated. |
protected void |
incrementRequestCount() |
protected void |
incrementResponseCount() |
boolean |
isDataAvailable(Timeout timeout)
Checks if input data is available from the connection.
|
boolean |
isOpen()
Checks if this connection is open.
|
boolean |
isStale()
Checks whether this connection has gone down.
|
protected void |
onRequestSubmitted(ClassicHttpRequest request) |
protected void |
onResponseReceived(ClassicHttpResponse response) |
void |
setSocketTimeout(Timeout timeout)
Sets the socket timeout value.
|
String |
toString() |
isConsistent, receiveResponseEntity, receiveResponseHeader, sendRequestEntity, sendRequestHeader, terminateRequestclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitflush, isDataAvailable, isStalegetEndpointDetails, getLocalAddress, getProtocolVersion, getRemoteAddress, getSSLSession, isOpengetSocketTimeout, setSocketTimeoutpublic LoggingBHttpClientConnection(Http1Config http1Config, CharsetDecoder charDecoder, CharsetEncoder charEncoder, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory, HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory)
public LoggingBHttpClientConnection(Http1Config http1Config)
public String getId()
getId in interface Identifiablepublic void close()
throws IOException
HttpConnectionshutdown instead.close in interface Closeableclose in interface AutoCloseableclose in interface HttpConnectionIOExceptionpublic void close(CloseMode closeMode)
ModalCloseableclose in interface ModalCloseablecloseMode - How to close the receiver.public void bind(Socket socket) throws IOException
Socket. This socket will be
used by the connection to send and receive data.
After this method's execution the connection status will be reported
as open and the isOpen() will return true.
bind in class DefaultBHttpClientConnectionsocket - the socket.IOException - in case of an I/O error.protected void onResponseReceived(ClassicHttpResponse response)
onResponseReceived in class DefaultBHttpClientConnectionprotected void onRequestSubmitted(ClassicHttpRequest request)
onRequestSubmitted in class DefaultBHttpClientConnectionprotected SocketHolder ensureOpen() throws IOException
IOExceptionprotected void bind(SocketHolder socketHolder) throws IOException
IOExceptionpublic boolean isOpen()
HttpConnectionisOpen in interface HttpConnectionpublic ProtocolVersion getProtocolVersion()
HttpConnectionnull if unknown.getProtocolVersion in interface HttpConnectionnull if unknown.protected SocketHolder getSocketHolder()
protected OutputStream createContentOutputStream(long len, SessionOutputBuffer buffer, OutputStream outputStream, Supplier<List<? extends Header>> trailers)
protected InputStream createContentInputStream(long len, SessionInputBuffer buffer, InputStream inputStream)
public SocketAddress getRemoteAddress()
HttpConnectionnull if it is not connected yet or
unconnected.getRemoteAddress in interface HttpConnectionnull if it is not connected yet or
unconnected.public SocketAddress getLocalAddress()
HttpConnectionnull if it is not bound yet.getLocalAddress in interface HttpConnectionnull if it is not bound yet.public void setSocketTimeout(Timeout timeout)
SocketModalCloseablesetSocketTimeout in interface SocketModalCloseabletimeout - timeout valuepublic Timeout getSocketTimeout()
SocketModalCloseablegetSocketTimeout in interface SocketModalCloseableprotected boolean awaitInput(Timeout timeout) throws IOException
IOExceptionpublic boolean isDataAvailable(Timeout timeout) throws IOException
BHttpConnectionisDataAvailable in interface BHttpConnectiontimeout - the maximum time to wait for datatimeout.IOException - if an error happens on the connectionpublic boolean isStale()
throws IOException
BHttpConnectionisStale in interface BHttpConnectiontrue if attempts to use this connection are
likely to succeed, or false if they are likely
to fail and this connection should be closedIOExceptionpublic void flush()
throws IOException
BHttpConnectionflush in interface BHttpConnectionIOException - in case of an I/O errorprotected void incrementRequestCount()
protected void incrementResponseCount()
public SSLSession getSSLSession()
HttpConnectionnull if TLS has not been activated.getSSLSession in interface HttpConnectionnull if TLS has not been activated.public EndpointDetails getEndpointDetails()
HttpConnectiongetEndpointDetails in interface HttpConnectionCopyright © 2005–2021 The Apache Software Foundation. All rights reserved.