Class SimpleHTTPClient

java.lang.Object
org.forgerock.util.SimpleHTTPClient

public class SimpleHTTPClient extends Object
Simple helper client for connecting to URLs over HTTP and retrieving their contents via a GET request. Settable timeouts on read and connection.
  • Field Details

  • Constructor Details

    • SimpleHTTPClient

      Generates a new SimpleHTTPClient with the appropriate timeouts.
    • SimpleHTTPClient

      public SimpleHTTPClient(int readTimeout, int connTimeout)
      Generates a new SimpleHTTPClient with the appropriate timeouts.
      Parameters:
      readTimeout - read timeout value (greater than or equal to zero)
      connTimeout - connection timeout value (greater than or equal to zero)
  • Method Details

    • get

      public String get(URL url) throws IOException
      Utility method for gathering the contents of an HTTP page. Should ideally be in an HTTP Client utils type package, rather than here.
      Parameters:
      url - from which to attempt to retrieve the contents
      Returns:
      The contents of the provided url
      Throws:
      IOException - If there are any problems connecting to or gathering the contents of the page