Class URLProtocol

java.lang.Object
com.helger.commons.url.URLProtocol
All Implemented Interfaces:
IURLProtocol

public class URLProtocol extends Object implements IURLProtocol
A simple implementation of the IURLProtocol interface.
Author:
Philip Helger
  • Constructor Details

  • Method Details

    • getProtocol

      @Nonnull @Nonempty public String getProtocol()
      Description copied from interface: IURLProtocol
      Retrieve the URL protocol prefix to be used. May contain "//".
      Specified by:
      getProtocol in interface IURLProtocol
      Returns:
      The underlying text representation of the protocol. Never null nor empty.
    • isUsedInURL

      public boolean isUsedInURL(@Nullable String sURL)
      Description copied from interface: IURLProtocol
      Tells if the passed String (URL) belongs to this protocol.
      Specified by:
      isUsedInURL in interface IURLProtocol
      Parameters:
      sURL - The URL to check. May be null.
      Returns:
      true if the passed URL starts with this protocol
    • getWithProtocol

      @Nullable public String getWithProtocol(@Nullable String sURL)
      Description copied from interface: IURLProtocol
      Prefix the passed URL with this protocol.
      Specified by:
      getWithProtocol in interface IURLProtocol
      Parameters:
      sURL - The URL to be prefixed. May be null.
      Returns:
      null if the parameter is null. The protocol is prepended independent whether the URL already has a protocol or not.
    • getWithProtocolIfNone

      @Nullable public String getWithProtocolIfNone(@Nullable String sURL)
      Description copied from interface: IURLProtocol
      Prefix the passed URL with this protocol if the URL does not have a protocol yet.
      Specified by:
      getWithProtocolIfNone in interface IURLProtocol
      Parameters:
      sURL - The URL to be prefixed. May be null.
      Returns:
      null if the parameter is null. The protocol is prepended if the URL not already has a protocol.
    • allowsForQueryParameters

      public boolean allowsForQueryParameters()
      Specified by:
      allowsForQueryParameters in interface IURLProtocol
      Returns:
      true if this protocol can handle HTTP query parameters (?x=y&z=1), false if not.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object