Class DefaultManagedHttpClientConnection
- java.lang.Object
-
- org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
-
- org.apache.hc.client5.http.impl.io.DefaultManagedHttpClientConnection
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,ManagedHttpClientConnection,org.apache.hc.core5.http.HttpConnection,org.apache.hc.core5.http.io.BHttpConnection,org.apache.hc.core5.http.io.HttpClientConnection,org.apache.hc.core5.http.SocketModalCloseable,org.apache.hc.core5.io.ModalCloseable,org.apache.hc.core5.util.Identifiable
final class DefaultManagedHttpClientConnection extends org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection implements ManagedHttpClientConnection, org.apache.hc.core5.util.Identifiable
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicBooleanclosedprivate static org.slf4j.LoggerHEADER_LOGprivate java.lang.Stringidprivate static org.slf4j.LoggerLOGprivate org.apache.hc.core5.util.TimeoutsocketTimeoutprivate static org.slf4j.LoggerWIRE_LOG
-
Constructor Summary
Constructors Constructor Description DefaultManagedHttpClientConnection(java.lang.String id)DefaultManagedHttpClientConnection(java.lang.String id, java.nio.charset.CharsetDecoder charDecoder, java.nio.charset.CharsetEncoder charEncoder, org.apache.hc.core5.http.config.Http1Config h1Config, org.apache.hc.core5.http.ContentLengthStrategy incomingContentStrategy, org.apache.hc.core5.http.ContentLengthStrategy outgoingContentStrategy, org.apache.hc.core5.http.io.HttpMessageWriterFactory<org.apache.hc.core5.http.ClassicHttpRequest> requestWriterFactory, org.apache.hc.core5.http.io.HttpMessageParserFactory<org.apache.hc.core5.http.ClassicHttpResponse> responseParserFactory)DefaultManagedHttpClientConnection(java.lang.String id, java.nio.charset.CharsetDecoder charDecoder, java.nio.charset.CharsetEncoder charEncoder, org.apache.hc.core5.http.config.Http1Config h1Config, org.apache.hc.core5.http.ContentLengthStrategy incomingContentStrategy, org.apache.hc.core5.http.ContentLengthStrategy outgoingContentStrategy, org.apache.hc.core5.http.io.ResponseOutOfOrderStrategy responseOutOfOrderStrategy, org.apache.hc.core5.http.io.HttpMessageWriterFactory<org.apache.hc.core5.http.ClassicHttpRequest> requestWriterFactory, org.apache.hc.core5.http.io.HttpMessageParserFactory<org.apache.hc.core5.http.ClassicHttpResponse> responseParserFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate()Restores the connection from idle mode.protected booleanawaitInput(org.apache.hc.core5.util.Timeout arg0)voidbind(java.net.Socket socket)Binds this connection to the given socket.voidbind(org.apache.hc.core5.http.impl.io.SocketHolder socketHolder)voidclose()voidclose(org.apache.hc.core5.io.CloseMode closeMode)protected java.io.InputStreamcreateContentInputStream(long arg0, org.apache.hc.core5.http.io.SessionInputBuffer arg1, java.io.InputStream arg2)protected java.io.OutputStreamcreateContentOutputStream(long arg0, org.apache.hc.core5.http.io.SessionOutputBuffer arg1, java.io.OutputStream arg2, org.apache.hc.core5.function.Supplier<java.util.List<? extends org.apache.hc.core5.http.Header>> arg3)protected org.apache.hc.core5.http.impl.io.SocketHolderensureOpen()voidflush()org.apache.hc.core5.http.EndpointDetailsgetEndpointDetails()java.lang.StringgetId()java.net.SocketAddressgetLocalAddress()org.apache.hc.core5.http.ProtocolVersiongetProtocolVersion()java.net.SocketAddressgetRemoteAddress()java.net.SocketgetSocket()Returns the underlying socket.protected org.apache.hc.core5.http.impl.io.SocketHoldergetSocketHolder()org.apache.hc.core5.util.TimeoutgetSocketTimeout()javax.net.ssl.SSLSessiongetSSLSession()Obtains the SSL session of the underlying connection, if any.protected voidincrementRequestCount()protected voidincrementResponseCount()booleanisDataAvailable(org.apache.hc.core5.util.Timeout arg0)booleanisOpen()booleanisStale()protected voidonRequestSubmitted(org.apache.hc.core5.http.ClassicHttpRequest request)protected voidonResponseReceived(org.apache.hc.core5.http.ClassicHttpResponse response)voidpassivate()Puts the connection into idle mode.voidsetSocketTimeout(org.apache.hc.core5.util.Timeout timeout)java.lang.StringtoString()-
Methods inherited from class org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
isConsistent, receiveResponseEntity, receiveResponseHeader, sendRequestEntity, sendRequestHeader, terminateRequest
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.hc.core5.http.io.BHttpConnection
flush, isDataAvailable, isStale
-
Methods inherited from interface org.apache.hc.core5.http.io.HttpClientConnection
isConsistent, receiveResponseEntity, receiveResponseHeader, sendRequestEntity, sendRequestHeader, terminateRequest
-
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
HEADER_LOG
private static final org.slf4j.Logger HEADER_LOG
-
WIRE_LOG
private static final org.slf4j.Logger WIRE_LOG
-
id
private final java.lang.String id
-
closed
private final java.util.concurrent.atomic.AtomicBoolean closed
-
socketTimeout
private org.apache.hc.core5.util.Timeout socketTimeout
-
-
Constructor Detail
-
DefaultManagedHttpClientConnection
public DefaultManagedHttpClientConnection(java.lang.String id, java.nio.charset.CharsetDecoder charDecoder, java.nio.charset.CharsetEncoder charEncoder, org.apache.hc.core5.http.config.Http1Config h1Config, org.apache.hc.core5.http.ContentLengthStrategy incomingContentStrategy, org.apache.hc.core5.http.ContentLengthStrategy outgoingContentStrategy, org.apache.hc.core5.http.io.ResponseOutOfOrderStrategy responseOutOfOrderStrategy, org.apache.hc.core5.http.io.HttpMessageWriterFactory<org.apache.hc.core5.http.ClassicHttpRequest> requestWriterFactory, org.apache.hc.core5.http.io.HttpMessageParserFactory<org.apache.hc.core5.http.ClassicHttpResponse> responseParserFactory)
-
DefaultManagedHttpClientConnection
public DefaultManagedHttpClientConnection(java.lang.String id, java.nio.charset.CharsetDecoder charDecoder, java.nio.charset.CharsetEncoder charEncoder, org.apache.hc.core5.http.config.Http1Config h1Config, org.apache.hc.core5.http.ContentLengthStrategy incomingContentStrategy, org.apache.hc.core5.http.ContentLengthStrategy outgoingContentStrategy, org.apache.hc.core5.http.io.HttpMessageWriterFactory<org.apache.hc.core5.http.ClassicHttpRequest> requestWriterFactory, org.apache.hc.core5.http.io.HttpMessageParserFactory<org.apache.hc.core5.http.ClassicHttpResponse> responseParserFactory)
-
DefaultManagedHttpClientConnection
public DefaultManagedHttpClientConnection(java.lang.String id)
-
-
Method Detail
-
getId
public java.lang.String getId()
- Specified by:
getIdin interfaceorg.apache.hc.core5.util.Identifiable
-
bind
public void bind(org.apache.hc.core5.http.impl.io.SocketHolder socketHolder) throws java.io.IOException- Throws:
java.io.IOException
-
getSocket
public java.net.Socket getSocket()
Description copied from interface:ManagedHttpClientConnectionReturns the underlying socket.- Specified by:
getSocketin interfaceManagedHttpClientConnection
-
getSSLSession
public javax.net.ssl.SSLSession getSSLSession()
Description copied from interface:ManagedHttpClientConnectionObtains the SSL session of the underlying connection, if any. If this connection is open, and the underlying socket is anSSLSocket, the SSL session of that socket is obtained. This is a potentially blocking operation.- Specified by:
getSSLSessionin interfaceorg.apache.hc.core5.http.HttpConnection- Specified by:
getSSLSessionin interfaceManagedHttpClientConnection- Returns:
- the underlying SSL session if available,
nullotherwise
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceorg.apache.hc.core5.http.HttpConnection- Throws:
java.io.IOException
-
setSocketTimeout
public void setSocketTimeout(org.apache.hc.core5.util.Timeout timeout)
- Specified by:
setSocketTimeoutin interfaceorg.apache.hc.core5.http.SocketModalCloseable
-
close
public void close(org.apache.hc.core5.io.CloseMode closeMode)
- Specified by:
closein interfaceorg.apache.hc.core5.io.ModalCloseable
-
bind
public void bind(java.net.Socket socket) throws java.io.IOExceptionDescription copied from interface:ManagedHttpClientConnectionBinds this connection to the given socket. The connection is considered open if it is bound and the underlying socket is connection to a remote host.- Specified by:
bindin interfaceManagedHttpClientConnection- Overrides:
bindin classorg.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection- Parameters:
socket- the socket to bind the connection to.- Throws:
java.io.IOException
-
onResponseReceived
protected void onResponseReceived(org.apache.hc.core5.http.ClassicHttpResponse response)
- Overrides:
onResponseReceivedin classorg.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
-
onRequestSubmitted
protected void onRequestSubmitted(org.apache.hc.core5.http.ClassicHttpRequest request)
- Overrides:
onRequestSubmittedin classorg.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
-
passivate
public void passivate()
Description copied from interface:ManagedHttpClientConnectionPuts the connection into idle mode.- Specified by:
passivatein interfaceManagedHttpClientConnection
-
activate
public void activate()
Description copied from interface:ManagedHttpClientConnectionRestores the connection from idle mode.- Specified by:
activatein interfaceManagedHttpClientConnection
-
ensureOpen
protected org.apache.hc.core5.http.impl.io.SocketHolder ensureOpen() throws java.io.IOException- Throws:
java.io.IOException
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfaceorg.apache.hc.core5.http.HttpConnection
-
getProtocolVersion
public org.apache.hc.core5.http.ProtocolVersion getProtocolVersion()
- Specified by:
getProtocolVersionin interfaceorg.apache.hc.core5.http.HttpConnection
-
getSocketHolder
protected org.apache.hc.core5.http.impl.io.SocketHolder getSocketHolder()
-
createContentOutputStream
protected java.io.OutputStream createContentOutputStream(long arg0, org.apache.hc.core5.http.io.SessionOutputBuffer arg1, java.io.OutputStream arg2, org.apache.hc.core5.function.Supplier<java.util.List<? extends org.apache.hc.core5.http.Header>> arg3)
-
createContentInputStream
protected java.io.InputStream createContentInputStream(long arg0, org.apache.hc.core5.http.io.SessionInputBuffer arg1, java.io.InputStream arg2)
-
getRemoteAddress
public java.net.SocketAddress getRemoteAddress()
- Specified by:
getRemoteAddressin interfaceorg.apache.hc.core5.http.HttpConnection
-
getLocalAddress
public java.net.SocketAddress getLocalAddress()
- Specified by:
getLocalAddressin interfaceorg.apache.hc.core5.http.HttpConnection
-
getSocketTimeout
public org.apache.hc.core5.util.Timeout getSocketTimeout()
- Specified by:
getSocketTimeoutin interfaceorg.apache.hc.core5.http.SocketModalCloseable
-
awaitInput
protected boolean awaitInput(org.apache.hc.core5.util.Timeout arg0) throws java.io.IOException- Throws:
java.io.IOException
-
isDataAvailable
public boolean isDataAvailable(org.apache.hc.core5.util.Timeout arg0) throws java.io.IOException- Specified by:
isDataAvailablein interfaceorg.apache.hc.core5.http.io.BHttpConnection- Throws:
java.io.IOException
-
isStale
public boolean isStale() throws java.io.IOException- Specified by:
isStalein interfaceorg.apache.hc.core5.http.io.BHttpConnection- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfaceorg.apache.hc.core5.http.io.BHttpConnection- Throws:
java.io.IOException
-
incrementRequestCount
protected void incrementRequestCount()
-
incrementResponseCount
protected void incrementResponseCount()
-
getEndpointDetails
public org.apache.hc.core5.http.EndpointDetails getEndpointDetails()
- Specified by:
getEndpointDetailsin interfaceorg.apache.hc.core5.http.HttpConnection
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-