Class DefaultManagedHttpClientConnection
java.lang.Object
org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
org.apache.hc.client5.http.impl.io.DefaultManagedHttpClientConnection
- All Implemented Interfaces:
Closeable, 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
FieldsModifier and TypeFieldDescriptionprivate final AtomicBooleanprivate static final org.slf4j.Loggerprivate final Stringprivate static final org.slf4j.Loggerprivate org.apache.hc.core5.util.Timeoutprivate static final org.slf4j.Logger -
Constructor Summary
ConstructorsConstructorDescriptionDefaultManagedHttpClientConnection(String id, CharsetDecoder charDecoder, 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(String id, CharsetDecoder charDecoder, 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
Modifier and TypeMethodDescriptionvoidactivate()Restores the connection from idle mode.protected booleanawaitInput(org.apache.hc.core5.util.Timeout arg0) voidBinds 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 InputStreamcreateContentInputStream(long arg0, org.apache.hc.core5.http.io.SessionInputBuffer arg1, InputStream arg2) protected OutputStreamcreateContentOutputStream(long arg0, org.apache.hc.core5.http.io.SessionOutputBuffer arg1, OutputStream arg2, org.apache.hc.core5.function.Supplier<List<? extends org.apache.hc.core5.http.Header>> arg3) protected org.apache.hc.core5.http.impl.io.SocketHoldervoidflush()org.apache.hc.core5.http.EndpointDetailsgetId()org.apache.hc.core5.http.ProtocolVersionReturns the underlying socket.protected org.apache.hc.core5.http.impl.io.SocketHolderorg.apache.hc.core5.util.TimeoutObtains the SSL session of the underlying connection, if any.protected voidprotected voidbooleanisDataAvailable(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) voidPuts the connection into idle mode.voidsetSocketTimeout(org.apache.hc.core5.util.Timeout timeout) toString()Methods inherited from class org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
isConsistent, receiveResponseEntity, receiveResponseHeader, sendRequestEntity, sendRequestHeader, terminateRequestMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hc.core5.http.io.BHttpConnection
flush, isDataAvailable, isStaleMethods inherited from interface org.apache.hc.core5.http.io.HttpClientConnection
isConsistent, receiveResponseEntity, receiveResponseHeader, sendRequestEntity, sendRequestHeader, terminateRequestMethods inherited from interface org.apache.hc.core5.http.HttpConnection
getEndpointDetails, getLocalAddress, getProtocolVersion, getRemoteAddress, isOpenMethods inherited from interface org.apache.hc.core5.http.SocketModalCloseable
getSocketTimeout
-
Field Details
-
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
-
closed
-
socketTimeout
private org.apache.hc.core5.util.Timeout socketTimeout
-
-
Constructor Details
-
DefaultManagedHttpClientConnection
public DefaultManagedHttpClientConnection(String id, CharsetDecoder charDecoder, 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(String id, CharsetDecoder charDecoder, 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
-
-
Method Details
-
getId
- Specified by:
getIdin interfaceorg.apache.hc.core5.util.Identifiable
-
bind
- Throws:
IOException
-
getSocket
Description copied from interface:ManagedHttpClientConnectionReturns the underlying socket.- Specified by:
getSocketin interfaceManagedHttpClientConnection
-
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
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.apache.hc.core5.http.HttpConnection- Throws:
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
Description 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:
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
- Throws:
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 OutputStream createContentOutputStream(long arg0, org.apache.hc.core5.http.io.SessionOutputBuffer arg1, OutputStream arg2, org.apache.hc.core5.function.Supplier<List<? extends org.apache.hc.core5.http.Header>> arg3) -
createContentInputStream
protected InputStream createContentInputStream(long arg0, org.apache.hc.core5.http.io.SessionInputBuffer arg1, InputStream arg2) -
getRemoteAddress
- Specified by:
getRemoteAddressin interfaceorg.apache.hc.core5.http.HttpConnection
-
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
- Throws:
IOException
-
isDataAvailable
- Specified by:
isDataAvailablein interfaceorg.apache.hc.core5.http.io.BHttpConnection- Throws:
IOException
-
isStale
- Specified by:
isStalein interfaceorg.apache.hc.core5.http.io.BHttpConnection- Throws:
IOException
-
flush
- Specified by:
flushin interfaceorg.apache.hc.core5.http.io.BHttpConnection- Throws:
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
-