Interface HttpConnection

All Known Implementing Classes:
ApacheHttpClientHttpConnection, DefaultHttpConnection

public interface HttpConnection
Expected sequence of calls is (BNF):
 header()* [outputStream()] [response()] [close()]
 
  • Method Details

    • header

      void header(String key, String value)
    • setConnectTimeoutMs

      void setConnectTimeoutMs(long connectTimeoutMs)
    • setReadTimeoutMs

      void setReadTimeoutMs(long readTimeoutMs)
    • output

      void output(Consumer<? super OutputStream> consumer, String contentType, Optional<String> contentEncoding, boolean chunked)
      When a consumer is defined (when this method is called), this class is expected to set the Content-Type and Content-Length fields (and support chunking if requested).
      Parameters:
      consumer - action to be performed on the OutputStream
      contentType - Content-Type header value
      contentEncoding - if present is appended to the Content-Type value
    • response

      Response response() throws IOException
      Throws:
      IOException
    • close

      void close() throws IOException
      Throws:
      IOException