Module id.xfunction

Class XHttpClient


public class XHttpClient extends Object
Class which provides wrapping for basic HttpClient operations and takes care of creating HttpRequest with proper BodyHandlers.

Requires Java 11 or higher.

  • Field Details

    • httpClient

      public static XHttpClient httpClient
      Default global instance of the client
  • Constructor Details

    • XHttpClient

      public XHttpClient()
  • Method Details

    • getLines

      public Stream<String> getLines(String api)
      Calls given HTTP API and returns output as Stream of lines.
    • getString

      public String getString(String api)
    • getFile

      public Path getFile(String api, Path outputFile)
      Calls given HTTP API and saves output to a given file