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

    Fields
    Modifier and Type
    Field
    Description
    private 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

    Constructors
    Constructor
    Description
     
    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(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 Type
    Method
    Description
    void
    Restores the connection from idle mode.
    protected boolean
    awaitInput(org.apache.hc.core5.util.Timeout arg0)
     
    void
    bind(Socket socket)
    Binds this connection to the given socket.
    void
    bind(org.apache.hc.core5.http.impl.io.SocketHolder socketHolder)
     
    void
     
    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
     
    org.apache.hc.core5.http.EndpointDetails
     
     
     
    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
     
    boolean
     
    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)
     
     

    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

      private final String id
    • closed

      private final AtomicBoolean 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

      public DefaultManagedHttpClientConnection(String id)
  • Method Details

    • getId

      public String getId()
      Specified by:
      getId in interface org.apache.hc.core5.util.Identifiable
    • bind

      public void bind(org.apache.hc.core5.http.impl.io.SocketHolder socketHolder) throws IOException
      Throws:
      IOException
    • getSocket

      public Socket getSocket()
      Description copied from interface: ManagedHttpClientConnection
      Returns the underlying socket.
      Specified by:
      getSocket in interface ManagedHttpClientConnection
    • getSSLSession

      public SSLSession 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 an SSLSocket, the SSL session of that socket is obtained. This is a potentially blocking operation.
      Specified by:
      getSSLSession in interface org.apache.hc.core5.http.HttpConnection
      Specified by:
      getSSLSession in interface ManagedHttpClientConnection
      Returns:
      the underlying SSL session if available, null otherwise
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.apache.hc.core5.http.HttpConnection
      Throws:
      IOException
    • setSocketTimeout

      public void setSocketTimeout(org.apache.hc.core5.util.Timeout timeout)
      Specified by:
      setSocketTimeout in interface org.apache.hc.core5.http.SocketModalCloseable
    • close

      public void close(org.apache.hc.core5.io.CloseMode closeMode)
      Specified by:
      close in interface org.apache.hc.core5.io.ModalCloseable
    • bind

      public void bind(Socket socket) throws IOException
      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 interface ManagedHttpClientConnection
      Overrides:
      bind in class org.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 class org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
    • onRequestSubmitted

      protected void onRequestSubmitted(org.apache.hc.core5.http.ClassicHttpRequest request)
      Overrides:
      onRequestSubmitted in class org.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 interface ManagedHttpClientConnection
    • activate

      public void activate()
      Description copied from interface: ManagedHttpClientConnection
      Restores the connection from idle mode.
      Specified by:
      activate in interface ManagedHttpClientConnection
    • ensureOpen

      protected org.apache.hc.core5.http.impl.io.SocketHolder ensureOpen() throws IOException
      Throws:
      IOException
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface org.apache.hc.core5.http.HttpConnection
    • getProtocolVersion

      public org.apache.hc.core5.http.ProtocolVersion getProtocolVersion()
      Specified by:
      getProtocolVersion in interface org.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

      public SocketAddress getRemoteAddress()
      Specified by:
      getRemoteAddress in interface org.apache.hc.core5.http.HttpConnection
    • getLocalAddress

      public SocketAddress getLocalAddress()
      Specified by:
      getLocalAddress in interface org.apache.hc.core5.http.HttpConnection
    • getSocketTimeout

      public org.apache.hc.core5.util.Timeout getSocketTimeout()
      Specified by:
      getSocketTimeout in interface org.apache.hc.core5.http.SocketModalCloseable
    • awaitInput

      protected boolean awaitInput(org.apache.hc.core5.util.Timeout arg0) throws IOException
      Throws:
      IOException
    • isDataAvailable

      public boolean isDataAvailable(org.apache.hc.core5.util.Timeout arg0) throws IOException
      Specified by:
      isDataAvailable in interface org.apache.hc.core5.http.io.BHttpConnection
      Throws:
      IOException
    • isStale

      public boolean isStale() throws IOException
      Specified by:
      isStale in interface org.apache.hc.core5.http.io.BHttpConnection
      Throws:
      IOException
    • flush

      public void flush() throws IOException
      Specified by:
      flush in interface org.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 interface org.apache.hc.core5.http.HttpConnection
    • toString

      public String toString()
      Overrides:
      toString in class Object