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 AtomicBoolean
private static final org.slf4j.Logger
private final String
private static final org.slf4j.Logger
private org.apache.hc.core5.util.Timeout
private 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 TypeMethodDescriptionvoid
activate()
Restores the connection from idle mode.protected boolean
awaitInput
(org.apache.hc.core5.util.Timeout arg0) void
Binds this connection to the given socket.void
bind
(org.apache.hc.core5.http.impl.io.SocketHolder socketHolder) void
close()
void
close
(org.apache.hc.core5.io.CloseMode closeMode) protected InputStream
createContentInputStream
(long arg0, org.apache.hc.core5.http.io.SessionInputBuffer arg1, InputStream arg2) 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) protected org.apache.hc.core5.http.impl.io.SocketHolder
void
flush()
org.apache.hc.core5.http.EndpointDetails
getId()
org.apache.hc.core5.http.ProtocolVersion
Returns the underlying socket.protected org.apache.hc.core5.http.impl.io.SocketHolder
org.apache.hc.core5.util.Timeout
Obtains the SSL session of the underlying connection, if any.protected void
protected void
boolean
isDataAvailable
(org.apache.hc.core5.util.Timeout arg0) boolean
isOpen()
boolean
isStale()
protected void
onRequestSubmitted
(org.apache.hc.core5.http.ClassicHttpRequest request) protected void
onResponseReceived
(org.apache.hc.core5.http.ClassicHttpResponse response) void
Puts the connection into idle mode.void
setSocketTimeout
(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, 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
Methods inherited from interface org.apache.hc.core5.http.HttpConnection
getEndpointDetails, getLocalAddress, getProtocolVersion, getRemoteAddress, isOpen
Methods 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:
getId
in interfaceorg.apache.hc.core5.util.Identifiable
-
bind
- Throws:
IOException
-
getSocket
Description copied from interface:ManagedHttpClientConnection
Returns the underlying socket.- Specified by:
getSocket
in interfaceManagedHttpClientConnection
-
getSSLSession
Description copied from interface:ManagedHttpClientConnection
Obtains 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:
getSSLSession
in interfaceorg.apache.hc.core5.http.HttpConnection
- Specified by:
getSSLSession
in interfaceManagedHttpClientConnection
- Returns:
- the underlying SSL session if available,
null
otherwise
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceorg.apache.hc.core5.http.HttpConnection
- Throws:
IOException
-
setSocketTimeout
public void setSocketTimeout(org.apache.hc.core5.util.Timeout timeout) - Specified by:
setSocketTimeout
in interfaceorg.apache.hc.core5.http.SocketModalCloseable
-
close
public void close(org.apache.hc.core5.io.CloseMode closeMode) - Specified by:
close
in interfaceorg.apache.hc.core5.io.ModalCloseable
-
bind
Description copied from interface:ManagedHttpClientConnection
Binds 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:
bind
in interfaceManagedHttpClientConnection
- Overrides:
bind
in 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:
onResponseReceived
in classorg.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
-
onRequestSubmitted
protected void onRequestSubmitted(org.apache.hc.core5.http.ClassicHttpRequest request) - Overrides:
onRequestSubmitted
in classorg.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
-
passivate
public void passivate()Description copied from interface:ManagedHttpClientConnection
Puts the connection into idle mode.- Specified by:
passivate
in interfaceManagedHttpClientConnection
-
activate
public void activate()Description copied from interface:ManagedHttpClientConnection
Restores the connection from idle mode.- Specified by:
activate
in interfaceManagedHttpClientConnection
-
ensureOpen
- Throws:
IOException
-
isOpen
public boolean isOpen()- Specified by:
isOpen
in interfaceorg.apache.hc.core5.http.HttpConnection
-
getProtocolVersion
public org.apache.hc.core5.http.ProtocolVersion getProtocolVersion()- Specified by:
getProtocolVersion
in 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:
getRemoteAddress
in interfaceorg.apache.hc.core5.http.HttpConnection
-
getLocalAddress
- Specified by:
getLocalAddress
in interfaceorg.apache.hc.core5.http.HttpConnection
-
getSocketTimeout
public org.apache.hc.core5.util.Timeout getSocketTimeout()- Specified by:
getSocketTimeout
in interfaceorg.apache.hc.core5.http.SocketModalCloseable
-
awaitInput
- Throws:
IOException
-
isDataAvailable
- Specified by:
isDataAvailable
in interfaceorg.apache.hc.core5.http.io.BHttpConnection
- Throws:
IOException
-
isStale
- Specified by:
isStale
in interfaceorg.apache.hc.core5.http.io.BHttpConnection
- Throws:
IOException
-
flush
- Specified by:
flush
in 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:
getEndpointDetails
in interfaceorg.apache.hc.core5.http.HttpConnection
-
toString
-