Interface IURLProtocol

  • All Known Implementing Classes:
    EURLProtocol, URLProtocol

    public interface IURLProtocol
    Base interface for an URL protocol descriptor. See EURLProtocol for an implementation.
    Author:
    Philip Helger
    • Method Detail

      • getProtocol

        @Nonnull
        @Nonempty
        String getProtocol()
        Retrieve the URL protocol prefix to be used. May contain "//".
        Returns:
        The underlying text representation of the protocol. Never null nor empty.
      • isUsedInURL

        boolean isUsedInURL​(@Nullable
                            String sURL)
        Tells if the passed String (URL) belongs to this protocol.
        Parameters:
        sURL - The URL to check. May be null.
        Returns:
        true if the passed URL starts with this protocol
      • getWithProtocol

        @Nullable
        String getWithProtocol​(@Nullable
                               String sURL)
        Prefix the passed URL with this protocol.
        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
        String getWithProtocolIfNone​(@Nullable
                                     String sURL)
        Prefix the passed URL with this protocol if the URL does not have a protocol yet.
        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

        boolean allowsForQueryParameters()
        Returns:
        true if this protocol can handle HTTP query parameters (?x=y&z=1), false if not.