java.lang.Object
org.sentrysoftware.metricshub.engine.client.http.Url

public class Url extends Object
Utility class for formatting URLs.
  • Constructor Details

    • Url

      public Url()
  • Method Details

    • format

      public static String format(@NonNull @NonNull String hostname, @NonNull @NonNull Integer port, @NonNull @NonNull String requestPath, @NonNull @NonNull String protocol)
      Generate the full URL based on the Path only.
      Parameters:
      hostname - hostname
      port - port of the request
      requestPath - request path of the request
      protocol - protocol used by the request
      Returns:
      formatted String
    • format

      public static String format(@NonNull @NonNull String url, @NonNull @NonNull String path)
      Generate the full URL based on the concatenation of URL and Path.
      Parameters:
      url - full URL inserted in the resource
      path - request path
      Returns:
      formatted String URL
    • format

      public static String format(String protocol, String hostname, Integer port, String path, String url)
      Generate the full URL.
      Parameters:
      protocol - protocol used by the request.
      hostname - hostname.
      port - port of the request.
      path - request path of the request.
      url - full URL if specified.
      Returns:
      formatted String URL.
      Throws:
      IllegalArgumentException - when neither URL nor path are specified for the source to monitor.