Package com.helger.commons.url
Interface IURLProtocol
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
EURLProtocol,URLProtocol
public interface IURLProtocol extends Serializable
Base 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()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()
- Returns:
- The underlying text representation of the protocol.
-
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)
-
-