Package com.helger.commons.url
Interface IURLProtocol
-
- All Known Implementing Classes:
EURLProtocol,URLProtocol
public interface IURLProtocolBase interface for an URL protocol descriptor. SeeEURLProtocolfor an implementation.- Author:
- Philip Helger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanallowsForQueryParameters()StringgetProtocol()Retrieve the URL protocol prefix to be used.StringgetWithProtocol(String sURL)Prefix the passed URL with this protocol.StringgetWithProtocolIfNone(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 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
nullnor empty.
-
isUsedInURL
boolean isUsedInURL(@Nullable String sURL)
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
@Nullable String getWithProtocol(@Nullable String sURL)
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
@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 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.
-
-