Class CloseableHttpConnection

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class CloseableHttpConnection
    extends CloseableConnection
    Closeable wrapper around a HttpURLConnection.

    Only the needed methods of HttpURLConnection are exposed.

    Closing the connection will trigger a disconnect on the underlying HttpUrlConnection

    • Field Detail

      • delegate

        private final java.net.HttpURLConnection delegate
    • Constructor Detail

      • CloseableHttpConnection

        CloseableHttpConnection​(java.net.HttpURLConnection delegate)
    • Method Detail

      • close

        public void close()
        triggers HttpURLConnection.disconnect().
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class CloseableConnection
      • getResponseCode

        public int getResponseCode()
                            throws java.io.IOException
        delegates to HttpURLConnection.getResponseCode()
        Overrides:
        getResponseCode in class CloseableConnection
        Throws:
        java.io.IOException