|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.confluence.web.UrlBuilder
public final class UrlBuilder
A builder which can construct URLs by adding parameters. Not thread-safe.
Constructor Summary | |
---|---|
UrlBuilder(java.lang.String baseUrl)
Constructs a UTF-8 URL builder with the given base URL. |
|
UrlBuilder(java.lang.String baseUrl,
java.lang.String encoding)
Constructs a builder with the given base URL, which should already be URL-encoded. |
Method Summary | |
---|---|
UrlBuilder |
add(java.lang.String name,
boolean value)
Adds a parameter to the URL. |
UrlBuilder |
add(java.lang.String name,
int value)
Adds a parameter to the URL. |
UrlBuilder |
add(java.lang.String name,
long value)
Adds a parameter to the URL. |
UrlBuilder |
add(java.lang.String name,
java.lang.String value)
Adds a parameter to the URL. |
UrlBuilder |
add(java.lang.String name,
java.lang.String[] values)
Retrieving parameters from a ServletRequest will provide you with String array values. |
UrlBuilder |
addAll(java.util.Map<java.lang.String,java.lang.Object> params)
Add multiple parameters to the URL from a map. |
UrlBuilder |
addAnchor(java.lang.String anchor)
Sets an anchor for the URL. |
java.lang.String |
toString()
|
java.lang.String |
toUrl()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public UrlBuilder(java.lang.String baseUrl)
UrlBuilder(String, String)
baseUrl
- The base URLpublic UrlBuilder(java.lang.String baseUrl, java.lang.String encoding)
baseUrl
- Base URL to which a query string is appendedencoding
- Encoding to use, e.g. UTF-8Method Detail |
---|
public UrlBuilder add(java.lang.String name, java.lang.String value) throws java.lang.IllegalArgumentException
name
- the name of the parametervalue
- the value of the parameter
java.lang.IllegalArgumentException
- if either the name or value is nullpublic UrlBuilder add(java.lang.String name, java.lang.String[] values)
name
- the name of the parametervalues
- one or more values for the parameter
java.lang.IllegalArgumentException
- if the name or values are null nullpublic UrlBuilder add(java.lang.String name, long value) throws java.lang.IllegalArgumentException
name
- Parameter name (part before =)value
- Parameter value (part after =)
java.lang.IllegalArgumentException
- When things are nulladd(String, String)
public UrlBuilder add(java.lang.String name, int value) throws java.lang.IllegalArgumentException
name
- Parameter name (part before =)value
- Parameter value (part after =)
java.lang.IllegalArgumentException
- When things are nulladd(String, String)
public UrlBuilder add(java.lang.String name, boolean value) throws java.lang.IllegalArgumentException
name
- Parameter name (part before =)value
- Parameter value (part after =)
java.lang.IllegalArgumentException
- When things are nulladd(String, String)
public UrlBuilder addAnchor(java.lang.String anchor)
anchor
- Anchor name (part after #)
public UrlBuilder addAll(java.util.Map<java.lang.String,java.lang.Object> params)
params
- A map of parameters to add to the URL
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toUrl()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |