Interface Url

  • All Superinterfaces:
    org.refcodes.mixin.CredentialsAccessor, org.refcodes.mixin.Dumpable, FragmentAccessor, HostAccessor, org.refcodes.mixin.IdentityAccessor, IpAddressAccessor, org.refcodes.mixin.PathAccessor, org.refcodes.mixin.PortAccessor, QueryFieldsAccessor, SchemeAccessor, org.refcodes.mixin.SecretAccessor
    All Known Subinterfaces:
    Url.UrlBuilder
    All Known Implementing Classes:
    UrlBuilderImpl, UrlImpl


    public interface Url
    extends org.refcodes.mixin.Dumpable, SchemeAccessor, HostAccessor, IpAddressAccessor, org.refcodes.mixin.PortAccessor, org.refcodes.mixin.PathAccessor, QueryFieldsAccessor, FragmentAccessor, org.refcodes.mixin.CredentialsAccessor
    An URL looks something like this: "scheme://[identity[:secret]@]host[:port][/path][?query][#fragment] In contrast to the java.net URL, this URL also supports "relative" locators with neither a scheme nor a host declaration. If the relative locator starts with a "/" slash, then we assume not having a host being provided: "/path?query#fragment" When it does *not* start with a "/" slash, then we assume that the first element being the host: "[identity[:secret]@]host[:port]/path[?query][#fragment]"
    • Method Detail

      • toHost

        default java.lang.String toHost​()
        Returns the "host" depending on whether an IP-Address has been provided or a host name.
        Returns:
        The determined host.
      • toHttpUrl

        default java.lang.String toHttpUrl​()
        Creates the complete "HTTP" URL String from the Url instance's state.
        Returns:
        The URL String for the given Url.
      • toLocator

        default java.lang.String toLocator​()
        Creates the locator part from the Url instance's state, excluding the fragment or the query fields.
        Returns:
        The locator for the given Url.
      • toURL

        default java.net.URL toURL​()
                            throws java.net.MalformedURLException
        Constructs an URL instance from your Url's state.
        Returns:
        THe according URL instance.
        Throws:
        java.net.MalformedURLException - thrown in case the state of your Url instance cannot be used to construct a valid URL, you may be missing some properties.