|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.util.UrlBuilder
@NotThreadSafe public final class UrlBuilder
Build a URL from parameters.
NOTE: This class does not HTML escape the URLS. Be very careful if using this class to output a URL on the UI.
Constructor Summary | |
---|---|
UrlBuilder(boolean snippet)
Create a builder with a blank URL. |
|
UrlBuilder(java.lang.String baseUrl)
Create a builder with the specified base URL. |
|
UrlBuilder(java.lang.String baseUrl,
boolean snippet)
Create a builder with the specified base URL. |
|
UrlBuilder(java.lang.String baseUrl,
java.lang.String encoding,
boolean snippet)
Create a builder with the specified base URL. |
|
UrlBuilder(UrlBuilder source)
Create a copy of the passed builder. |
Method Summary | |
---|---|
UrlBuilder |
addAnchor(java.lang.String value)
Add the passed anchor value to the URL while URL encoding it. |
UrlBuilder |
addParameter(java.lang.String name,
java.lang.String value)
Add the passed parameter to the URL while URL encoding them. |
UrlBuilder |
addParametersFromMap(java.util.Map<?,?> params)
Add multiple parameters from a map safely. |
UrlBuilder |
addParameterUnsafe(java.lang.String name,
java.lang.String value)
Add the passed parameter to the URL without URL encoding them. |
java.lang.String |
asUrlString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UrlBuilder(boolean snippet)
snippet
- whether or not this Url is complete or just a query snippet
java.lang.IllegalArgumentException
- if the base url is null.public UrlBuilder(UrlBuilder source)
source
- the builder to copy, cannot be null.
java.lang.IllegalArgumentException
- if source is null.public UrlBuilder(java.lang.String baseUrl)
baseUrl
- the basedUrl for the builder. This parameter will not be escaped in the resulting URL.
java.lang.IllegalArgumentException
- if the base url is null.public UrlBuilder(java.lang.String baseUrl, boolean snippet)
baseUrl
- the basedUrl for the builder. This parameter will not be escaped in the resulting URL.snippet
- whether or not this Url is complete or just a query snippet
java.lang.IllegalArgumentException
- if the base url is null.public UrlBuilder(java.lang.String baseUrl, java.lang.String encoding, boolean snippet)
baseUrl
- the basedUrl for the builder. This parameter will not be escaped in the resulting URL.snippet
- whether or not this Url is complete or just a query snippet.encoding
- the character encoding to use for parameter names and values. Can be left null (recommended) to indicate JIRA default encoding.
java.lang.IllegalArgumentException
- if the base url is null.Method Detail |
---|
public UrlBuilder addParameterUnsafe(java.lang.String name, java.lang.String value)
name
- the name of the parameter. This parameter name is not escaped before it is added to the URL. This
value cannot be blank.value
- the value of the parameter. This value is not escaped before it is added to the URL.
java.lang.IllegalArgumentException
- if name is blank.public UrlBuilder addParameter(java.lang.String name, java.lang.String value)
name
- the name of the parameter.This value cannot be blank.value
- the value of the parameter.
java.lang.IllegalArgumentException
- if name is blank.public UrlBuilder addAnchor(java.lang.String value)
#myAnchor
.
Note that to be compliant with standards, you will want to call this only after adding all your parameters.
value
- the value of the anchor.
java.lang.IllegalArgumentException
- if name is blank.public UrlBuilder addParametersFromMap(java.util.Map<?,?> params)
params
- map containing parameters to add. Must not be null.
public java.lang.String asUrlString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |