Interface BaseUrl


public interface BaseUrl
A base URL that can be used to connect to the running server.
Since:
4.0.0
Author:
Phillip Webb
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final BaseUrl
    Default base URL suitable for mock environments.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Return if the URL will ultimately resolve to an HTTPS address.
    static BaseUrl
    of(boolean https, Supplier<String> resolver)
    Factory method to create a new BaseUrl.
    static BaseUrl
    of(String url)
    Factory method to create a new BaseUrl.
    Resolve the URL to a string.
    default String
    resolve(@Nullable String path)
    Resolve the URL to a string.
  • Field Details

    • DEFAULT

      static final BaseUrl DEFAULT
      Default base URL suitable for mock environments.
  • Method Details

    • isHttps

      boolean isHttps()
      Return if the URL will ultimately resolve to an HTTPS address.
      Returns:
      if the URL is HTTPS
    • resolve

      default String resolve(@Nullable String path)
      Resolve the URL to a string. This method is called as late as possible to ensure that an local port information is available.
      Parameters:
      path - the path to append
      Returns:
      the resolved base URL
    • resolve

      String resolve()
      Resolve the URL to a string. This method is called as late as possible to ensure that an local port information is available.
      Returns:
      the resolved base URL
    • of

      static BaseUrl of(String url)
      Factory method to create a new BaseUrl.
      Parameters:
      url - the URL to use
      Returns:
      a new BaseUrl instance
    • of

      static BaseUrl of(boolean https, Supplier<String> resolver)
      Factory method to create a new BaseUrl.
      Parameters:
      https - whether the base URL is https
      resolver - the resolver used to supply the actual URL
      Returns:
      a new BaseUrl instance