Package com.helger.commons.url
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 Summary
Modifier and TypeMethodDescriptionbooleanRetrieve the URL protocol prefix to be used.getWithProtocol(String sURL) Prefix the passed URL with this protocol.getWithProtocolIfNone(String sURL) Prefix the passed URL with this protocol if the URL does not have a protocol yet.booleanisUsedInURL(String sURL) Tells if the passed String (URL) belongs to this protocol.
-
Method Details
-
getProtocol
Retrieve the URL protocol prefix to be used. May contain "//".- Returns:
- The underlying text representation of the protocol. Never
nullnor empty.
-
isUsedInURL
Tells if the passed String (URL) belongs to this protocol.- Parameters:
sURL- The URL to check. May benull.- Returns:
trueif the passed URL starts with this protocol
-
getWithProtocol
Prefix the passed URL with this protocol.- Parameters:
sURL- The URL to be prefixed. May benull.- Returns:
nullif the parameter isnull. The protocol is prepended independent whether the URL already has a protocol or not.
-
getWithProtocolIfNone
Prefix the passed URL with this protocol if the URL does not have a protocol yet.- Parameters:
sURL- The URL to be prefixed. May benull.- Returns:
nullif the parameter isnull. The protocol is prepended if the URL not already has a protocol.
-
allowsForQueryParameters
boolean allowsForQueryParameters()- Returns:
trueif this protocol can handle HTTP query parameters (?x=y&z=1),falseif not.
-