Package com.helger.commons.url
Class URLProtocol
java.lang.Object
com.helger.commons.url.URLProtocol
- All Implemented Interfaces:
IURLProtocol
A simple implementation of the
IURLProtocol interface.- Author:
- Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanRetrieve 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.inthashCode()booleanisUsedInURL(String sURL) Tells if the passed String (URL) belongs to this protocol.toString()
-
Constructor Details
-
URLProtocol
-
-
Method Details
-
getProtocol
Description copied from interface:IURLProtocolRetrieve the URL protocol prefix to be used. May contain "//".- Specified by:
getProtocolin interfaceIURLProtocol- Returns:
- The underlying text representation of the protocol. Never
nullnor empty.
-
isUsedInURL
Description copied from interface:IURLProtocolTells if the passed String (URL) belongs to this protocol.- Specified by:
isUsedInURLin interfaceIURLProtocol- Parameters:
sURL- The URL to check. May benull.- Returns:
trueif the passed URL starts with this protocol
-
getWithProtocol
Description copied from interface:IURLProtocolPrefix the passed URL with this protocol.- Specified by:
getWithProtocolin interfaceIURLProtocol- 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
Description copied from interface:IURLProtocolPrefix the passed URL with this protocol if the URL does not have a protocol yet.- Specified by:
getWithProtocolIfNonein interfaceIURLProtocol- 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
public boolean allowsForQueryParameters()- Specified by:
allowsForQueryParametersin interfaceIURLProtocol- Returns:
trueif this protocol can handle HTTP query parameters (?x=y&z=1),falseif not.
-
equals
-
hashCode
public int hashCode() -
toString
-