Class URIBuilder
URI
instances.- Since:
- 4.2
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty instance.URIBuilder
(String string) Construct an instance from the string which must be a valid URI.URIBuilder
(String string, Charset charset) Construct an instance from the string which must be a valid URI.URIBuilder
(URI uri) Construct an instance from the provided URI.URIBuilder
(URI uri, Charset charset) Construct an instance from the provided URI. -
Method Summary
Modifier and TypeMethodDescriptionaddParameter
(String param, String value) Adds parameter to URI query.addParameters
(List<NameValuePair> nvps) Adds URI query parameters.build()
Builds aURI
instance.Clears URI query parameters.getHost()
getPath()
int
getPort()
boolean
boolean
isOpaque()
boolean
boolean
Removes URI query.setCharset
(Charset charset) setCustomQuery
(String query) Sets custom URI query.setFragment
(String fragment) Sets URI fragment.Sets URI host.setParameter
(String param, String value) Sets parameter of URI query overriding existing value if set.setParameters
(List<NameValuePair> nvps) Sets URI query parameters.setParameters
(NameValuePair... nvps) Sets URI query parameters.Sets URI path.setPathSegments
(String... pathSegments) Sets URI path.setPathSegments
(List<String> pathSegments) Sets URI path.setPort
(int port) Sets URI port.Deprecated.Sets URI scheme.setUserInfo
(String userInfo) Sets URI user info.setUserInfo
(String username, String password) Sets URI user info as a combination of username and password.toString()
-
Constructor Details
-
URIBuilder
public URIBuilder()Constructs an empty instance. -
URIBuilder
Construct an instance from the string which must be a valid URI.- Parameters:
string
- a valid URI in string form- Throws:
URISyntaxException
- if the input is not a valid URI
-
URIBuilder
Construct an instance from the provided URI.- Parameters:
uri
-
-
URIBuilder
Construct an instance from the string which must be a valid URI.- Parameters:
string
- a valid URI in string form- Throws:
URISyntaxException
- if the input is not a valid URI
-
URIBuilder
Construct an instance from the provided URI.- Parameters:
uri
-
-
-
Method Details
-
setCharset
- Since:
- 4.4
-
getCharset
- Since:
- 4.4
-
build
Builds aURI
instance.- Throws:
URISyntaxException
-
setScheme
Sets URI scheme. -
setUserInfo
Sets URI user info. The value is expected to be unescaped and may contain non ASCII characters. -
setUserInfo
Sets URI user info as a combination of username and password. These values are expected to be unescaped and may contain non ASCII characters. -
setHost
Sets URI host. -
setPort
Sets URI port. -
setPath
Sets URI path. The value is expected to be unescaped and may contain non ASCII characters.- Returns:
- this.
-
setPathSegments
Sets URI path. The value is expected to be unescaped and may contain non ASCII characters.- Returns:
- this.
- Since:
- 4.5.8
-
setPathSegments
Sets URI path. The value is expected to be unescaped and may contain non ASCII characters.- Returns:
- this.
- Since:
- 4.5.8
-
removeQuery
Removes URI query. -
setQuery
Deprecated.(4.3) usesetParameters(List)
orsetParameters(NameValuePair...)
Sets URI query.The value is expected to be encoded form data.
- See Also:
-
setParameters
Sets URI query parameters. The parameter name / values are expected to be unescaped and may contain non ASCII characters.Please note query parameters and custom query component are mutually exclusive. This method will remove custom query if present.
- Since:
- 4.3
-
addParameters
Adds URI query parameters. The parameter name / values are expected to be unescaped and may contain non ASCII characters.Please note query parameters and custom query component are mutually exclusive. This method will remove custom query if present.
- Since:
- 4.3
-
setParameters
Sets URI query parameters. The parameter name / values are expected to be unescaped and may contain non ASCII characters.Please note query parameters and custom query component are mutually exclusive. This method will remove custom query if present.
- Since:
- 4.3
-
addParameter
Adds parameter to URI query. The parameter name and value are expected to be unescaped and may contain non ASCII characters.Please note query parameters and custom query component are mutually exclusive. This method will remove custom query if present.
-
setParameter
Sets parameter of URI query overriding existing value if set. The parameter name and value are expected to be unescaped and may contain non ASCII characters.Please note query parameters and custom query component are mutually exclusive. This method will remove custom query if present.
-
clearParameters
Clears URI query parameters.- Since:
- 4.3
-
setCustomQuery
Sets custom URI query. The value is expected to be unescaped and may contain non ASCII characters.Please note query parameters and custom query component are mutually exclusive. This method will remove query parameters if present.
- Since:
- 4.3
-
setFragment
Sets URI fragment. The value is expected to be unescaped and may contain non ASCII characters. -
isAbsolute
public boolean isAbsolute()- Since:
- 4.3
-
isOpaque
public boolean isOpaque()- Since:
- 4.3
-
getScheme
-
getUserInfo
-
getHost
-
getPort
public int getPort() -
isPathEmpty
public boolean isPathEmpty()- Since:
- 4.5.8
-
getPathSegments
- Since:
- 4.5.8
-
getPath
-
isQueryEmpty
public boolean isQueryEmpty()- Since:
- 4.5.8
-
getQueryParams
-
getFragment
-
toString
-
setParameters(List)
orsetParameters(NameValuePair...)