Package com.helger.commons.url
Class URLProtocolRegistry
java.lang.Object
com.helger.commons.url.URLProtocolRegistry
A central registry for supported URL protocols. By default, the registry will
include all protocols contained in
EURLProtocol, but it may be
extended by custom protocols- Author:
- Boris Gregorcic, Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic URLProtocolRegistrygetProtocol(ISimpleURL aURL) Try to evaluate the matching URL protocol from the passed URLgetProtocol(String sURL) Try to evaluate the matching URL protocol from the passed URLintgetWithoutProtocol(String sURL) Return the passed URL where the protocol has been stripped (if known)booleanhasKnownProtocol(ISimpleURL aURL) Check if the passed URL has any known protocolbooleanhasKnownProtocol(String sURL) Check if the passed URL has any known protocolstatic booleanvoidregisterProtocol(IURLProtocol aProtocol) Registers a new protocolvoidReinitialize all protocols.
-
Method Details
-
isInstantiated
public static boolean isInstantiated() -
getInstance
-
registerProtocol
Registers a new protocol- Parameters:
aProtocol- The protocol to be registered. May not benull.- Throws:
IllegalArgumentException- If another handler for this protocol is already installed.
-
getAllProtocols
- Returns:
- All registered protocols
-
getRegisteredProtocolCount
-
getProtocol
Try to evaluate the matching URL protocol from the passed URL- Parameters:
sURL- The URL to get the protocol from- Returns:
- The corresponding URL protocol or
nullif unresolved
-
getProtocol
Try to evaluate the matching URL protocol from the passed URL- Parameters:
aURL- The URL data- Returns:
- The corresponding URL protocol or
nullif unresolved
-
hasKnownProtocol
Check if the passed URL has any known protocol- Parameters:
sURL- The URL to analyze- Returns:
trueif the protocol is known,falseotherwise
-
hasKnownProtocol
Check if the passed URL has any known protocol- Parameters:
aURL- The URL to analyze- Returns:
trueif the protocol is known,falseotherwise
-
getWithoutProtocol
Return the passed URL where the protocol has been stripped (if known)- Parameters:
sURL- The URL to strip the protocol from. May benull.- Returns:
- The passed URL where any known protocol has been stripped
-
reinitialize
public void reinitialize()Reinitialize all protocols. Adds allEURLProtocolvalues and invokes all SPI implementations.
-