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 Details

    • toHost

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

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

      default 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 URL toURL() throws MalformedURLException
      Constructs an URL instance from your Url's state.
      Returns:
      The according URL instance.
      Throws:
      MalformedURLException - thrown in case the state of your Url instance cannot be used to construct a valid URL, you may be missing some properties.