Package com.helger.commons.url
Interface ISimpleURL
public interface ISimpleURL
Interface for a simple URL that works around the usability issues with the
Java default java.net.URL.
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptiondefault Stringdefault StringgetAsStringWithEncodedParameters(Charset aCharset) default Stringdefault URIgetAsURI()default URLgetAsURL()getPath()default IURLProtocoldefault booleandefault booleanCheck if this URL has an anchor with the passed name.default booleanparams()
-
Method Details
-
getProtocol
- Returns:
- The protocol used. May be
nullfor an unknown protocol.
-
hasKnownProtocol
default boolean hasKnownProtocol()- Returns:
trueif the URL has a known protocol
-
getPath
- Returns:
- The path part of the URL (everything before the "?" and the "#",
incl. the protocol). Never
nullbut maybe empty (e.g. for "?x=y").
-
params
- Returns:
- A map of all query string parameters. May be
null.
-
getAnchor
- Returns:
- The name of the anchor (everything after the "#") or
nullif none is defined.
-
hasAnchor
default boolean hasAnchor()- Returns:
trueif an anchor is present,falseotherwise.
-
hasAnchor
Check if this URL has an anchor with the passed name.- Parameters:
sAnchor- The anchor name to check.- Returns:
trueif the passed anchor is present.
-
getAsStringWithoutEncodedParameters
- Returns:
- The final string representation of this URL not encoding the request parameters.
-
getAsStringWithEncodedParameters
- Returns:
- The final string representation of this URL with encoded URL
parameter keys and values. Using the default URL charset as
determined by
URLHelper.CHARSET_URL_OBJ.
-
getAsStringWithEncodedParameters
- Parameters:
aCharset- The charset used for encoding the parameters. May not benull.- Returns:
- The final string representation of this URL with encoded URL parameter keys and values.
-
getAsURL
-
getAsURI
-