Class SystemBaseUrl

java.lang.Object
org.codice.ddf.configuration.SystemBaseUrl

public final class SystemBaseUrl extends Object
An immutable utility class for getting system url information. Information is pulled from the system properties.
  • Field Details

  • Method Details

    • getPort

      public String getPort()
      Gets the port number based on the the system protocol
      Returns:
    • getBaseUrl

      public String getBaseUrl()
      Constructs and returns the base url for the system using the system default protocol
      Returns:
    • getBaseUrl

      public String getBaseUrl(String proto)
      Constructs and returns the base url for the system given a protocol
      Parameters:
      proto - Protocol to use during url construction. A null value will cause the system default protocol to be used
      Returns:
    • constructUrl

      public String constructUrl(String context)
      Construct a url for the given context
      Parameters:
      context - The context path to be appened to the end of the base url
      Returns:
    • constructUrl

      public String constructUrl(String context, boolean includeRootContext)
      Construct a url for the given context
      Parameters:
      context - The context path to be appened to the end of the base url
      includeRootContext - Flag to indicated whether the rootcontext should be included in the url.
      Returns:
    • constructUrl

      public String constructUrl(String proto, String context)
      Construct a url based on the protocol and context
      Parameters:
      proto - Protocol to use during url construction. A null value will cause the system default protocol to be used
      context - The context path to be appened to the end of the base url
      Returns:
    • constructUrl

      public String constructUrl(String proto, String context, boolean includeRootContext)
      Construct a url based on the protocol and context
      Parameters:
      proto - Protocol to use during url construction. A null value will cause the system default protocol to be used
      context - The context path to be appened to the end of the base url
      includeRootContext - Flag to indicated whether the rootcontext should be included in the url.
      Returns:
    • getPort

      public String getPort(String proto)
      Gets the port number for the given protocol. If the protocol is null or not one of http or https returns the https port number.
      Parameters:
      proto - protocol (http or https)
      Returns:
    • getHttpPort

      public String getHttpPort()
    • getHttpsPort

      public String getHttpsPort()
    • getHost

      public String getHost()
      Gets the current host name or IP address from the system properties, or DEFAULT_HOST if not set.
      Returns:
      host name, IP address or DEFAULT_HOST
    • getProtocol

      public String getProtocol()
    • getRootContext

      public String getRootContext()