public class ERXMutableURL
extends java.lang.Object
| Constructor and Description |
|---|
ERXMutableURL()
Constructs a blank ERXMutableURL.
|
ERXMutableURL(java.lang.String str)
Constructs an ERXMutableURL with all of the properties of the given
external form of a URL.
|
ERXMutableURL(java.net.URL url)
Constructs an ERXMutableURL with all of the properties of the given URL.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addQueryParameter(java.lang.String key,
java.lang.String value)
Adds an additional query parameter to this URL.
|
void |
addQueryParameters(NSDictionary<java.lang.String,? extends java.lang.Object> queryParameters)
Adds additional query parameters to this URL from those defined in the
given NSDictionary.
|
void |
addQueryParameters(java.lang.String queryParameters)
Appends the query parameters of this URL with the given k=v&k2=v2 format
string.
|
void |
addQueryParametersMap(java.util.Map<java.lang.String,java.lang.String> queryParameters)
Adds additional query parameters to this URL from those defined in the
given Map.
|
ERXMutableURL |
appendPath(java.lang.String path)
Appends the given path to the end of the existing path.
|
void |
clearQueryParameters()
Clears the query parameters of this URL.
|
boolean |
containsQueryParameter(java.lang.String key)
Returns true if the given key is a query parameter key in this URL.
|
java.lang.String |
host()
Returns the host of this URL.
|
boolean |
isAbsolute()
Returns true if this is an absolute URL.
|
boolean |
isFullyQualified()
Returns true if there is a host defined for this URL.
|
static void |
main(java.lang.String[] args) |
java.lang.String |
path()
Returns the path of this URL.
|
java.lang.Integer |
port()
Returns the port of this URL (can be null).
|
java.lang.String |
protocol()
Returns the protocol of this URL.
|
java.lang.String |
queryParameter(java.lang.String key)
Returns the first query parameter for the given key.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
queryParameters()
Returns the query parameters of this URL as a Map.
|
java.util.List<java.lang.String> |
queryParameters(java.lang.String key)
Returns the query parameters for the given key.
|
java.lang.String |
queryParametersAsString()
Returns the query parameters of this URL as a String (in x=y&a=b syntax).
|
protected void |
queryParametersAsString(java.lang.StringBuffer sb) |
java.lang.String |
ref()
Returns the ref of this URL.
|
void |
removeQueryParameter(java.lang.String key)
Removes the query parameters with the given key.
|
void |
removeQueryParameter(java.lang.String key,
java.lang.String value)
Removes the query parameter value for the given key for multivalue
parameters.
|
void |
setHost(java.lang.String host)
Sets the host of this URL.
|
void |
setPath(java.lang.String path)
Sets the path of this URL.
|
void |
setPort(java.lang.Integer port)
Sets the port of this URL.
|
void |
setProtocol(java.lang.String protocol)
Sets the protocol of this URL (http, https, etc).
|
void |
setQueryParameter(java.lang.String key,
java.lang.String value)
Sets the given query parameter to the given value.
|
void |
setQueryParameters(NSDictionary<java.lang.String,? extends java.lang.Object> queryParameters)
Replaces the query parameters of this URL with those defined in the given
NSDictionary.
|
void |
setQueryParameters(java.lang.String queryParameters)
Replaces the query parameters of this URL with the given k=v&k2=v2 format
string.
|
void |
setQueryParametersMap(java.util.Map<java.lang.String,java.util.List<java.lang.String>> queryParameters)
Replaces the query parameters of this URL with those defined in the given
Map.
|
void |
setRef(java.lang.String ref)
Sets the ref of this URL (the #whatever part).
|
void |
setURL(java.lang.String str)
Sets the contents of this ERXMutableURL to be the same as the given URL
external form.
|
void |
setURL(java.net.URL url)
Sets the contents of this ERXMutableURL to be the same as the given URL.
|
java.lang.String |
toExternalForm()
Returns a String form of this URL.
|
java.lang.String |
toString() |
java.net.URL |
toURL()
Returns a java.net.URL object of this URL (which might fail if you have a
relative URL).
|
java.util.Map<java.lang.String,java.lang.String> |
uniqueQueryParameters()
Returns the query parameters of this URL as a Map uniqued by key (which
avoids multivalue properties at the expense of predictability).
|
public ERXMutableURL()
public ERXMutableURL(java.net.URL url)
throws java.net.MalformedURLException
url - the URL to copy data fromjava.net.MalformedURLException - if the URL is invalidpublic ERXMutableURL(java.lang.String str)
throws java.net.MalformedURLException
str - a URL external formjava.net.MalformedURLException - if the URL is invalidpublic void setURL(java.net.URL url)
throws java.net.MalformedURLException
url - the url to copy the contents fromjava.net.MalformedURLException - if the URL is malformedpublic void setURL(java.lang.String str)
throws java.net.MalformedURLException
str - the external form of a URL to copy the contents fromjava.net.MalformedURLException - if the external form of the URL is malformedpublic boolean isFullyQualified()
public boolean isAbsolute()
public void setProtocol(java.lang.String protocol)
protocol - the new protocolpublic java.lang.String protocol()
public void setHost(java.lang.String host)
host - the host of this URLpublic java.lang.String host()
public void setPath(java.lang.String path)
path - the path of this URLpublic java.lang.String path()
public ERXMutableURL appendPath(java.lang.String path)
path - the path to appendpublic void setPort(java.lang.Integer port)
port - the port of this URLpublic java.lang.Integer port()
public void setRef(java.lang.String ref)
ref - the ref of this URL (the #whatever part)public java.lang.String ref()
public void setQueryParameters(java.lang.String queryParameters)
throws java.net.MalformedURLException
queryParameters - the query parametersjava.net.MalformedURLException - if the string is malformedpublic void addQueryParameters(java.lang.String queryParameters)
throws java.net.MalformedURLException
queryParameters - the query parametersjava.net.MalformedURLException - if the string is malformedpublic void setQueryParametersMap(java.util.Map<java.lang.String,java.util.List<java.lang.String>> queryParameters)
queryParameters - the new query parameterspublic void clearQueryParameters()
public void setQueryParameters(NSDictionary<java.lang.String,? extends java.lang.Object> queryParameters)
queryParameters - the new query parameterspublic void addQueryParameters(NSDictionary<java.lang.String,? extends java.lang.Object> queryParameters)
queryParameters - the new query parameterspublic void addQueryParametersMap(java.util.Map<java.lang.String,java.lang.String> queryParameters)
queryParameters - the new query parameterspublic void addQueryParameter(java.lang.String key,
java.lang.String value)
key - the key of the new parametervalue - the value of the new parameterpublic boolean containsQueryParameter(java.lang.String key)
key - the key of the parameter to lookuppublic void removeQueryParameter(java.lang.String key)
key - the key of the query parameters to removepublic void removeQueryParameter(java.lang.String key,
java.lang.String value)
key - the key of the query parameters to lookupvalue - the value to remove.public java.util.Map<java.lang.String,java.util.List<java.lang.String>> queryParameters()
public java.util.Map<java.lang.String,java.lang.String> uniqueQueryParameters()
public java.util.List<java.lang.String> queryParameters(java.lang.String key)
key - the key to lookuppublic java.lang.String queryParameter(java.lang.String key)
key - the key to lookuppublic void setQueryParameter(java.lang.String key,
java.lang.String value)
key - the key to setvalue - the value to set it topublic java.lang.String toExternalForm()
public java.lang.String queryParametersAsString()
protected void queryParametersAsString(java.lang.StringBuffer sb)
public java.net.URL toURL()
throws java.net.MalformedURLException
java.net.MalformedURLException - if this URL cannot be represented as a java.net.URLpublic java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
throws java.net.MalformedURLException
java.net.MalformedURLExceptionCopyright © 2002 – 2022 Project Wonder.