| Modifier and Type | Method and Description |
|---|---|
UriBuilder |
absolutePath(boolean absolutePath)
Treat the path as absolute.
|
UriBuilder |
addParameter(String name,
boolean value)
Add a parameter to the query.
|
UriBuilder |
addParameter(String name,
int value)
Add a parameter to the query.
|
UriBuilder |
addParameter(String name,
long value)
Add a parameter to the query.
|
UriBuilder |
addParameter(String name,
String value)
Add a parameter to the query.
|
UriBuilder |
addParameters(Map<String,String> parameters)
Add parameters to the query.
|
UriBuilder |
appendRawPath(String path)
Append the given path to the current path.
|
URI |
build()
Get a URI object of this builder.
|
UriBuilder |
fragment(String fragment)
Set the fragment.
|
String |
getFragment()
Get the current fragment string, decoded, without leading '#'.
|
String |
getHost()
Get the host.
|
String |
getHostWithoutPath() |
Set<String> |
getParameterNames()
Get all unique parameter names.
|
String |
getParameterValue(String name)
Get the value for the given parameter name.
|
List<String> |
getParameterValues(String name)
Get all parameter values for the given parameter name.
|
List<String> |
getPathComponents()
Get the not URL encoded path components.
|
int |
getPort()
Get the port.
|
String |
getRawFragment()
Get the current fragment string, URL encoded, without leading '#'.
|
String |
getRawPath()
Get the raw, URL-encoded path.
|
String |
getRawQuery()
Get the current query string, URL encoded, without leading '?'.
|
String |
getRawUserInfo()
Get the user info, URL-encoded.
|
String |
getScheme()
Get the scheme.
|
UriBuilder |
host(String host)
Set the host.
|
boolean |
isAbsolutePath()
Return
true if the path is absolute. |
boolean |
isRelativePath()
Return
true if the path is relative. |
static UriBuilder |
of(String url)
Factory method.
|
static UriBuilder |
of(URI url)
Factory method.
|
static UriBuilder |
of(URL url)
Factory method.
|
UriBuilder |
pathComponent(String path)
Add a path component.
|
UriBuilder |
pathComponents(String... paths)
Add path components.
|
UriBuilder |
port(int port)
Set the port.
|
UriBuilder |
rawFragment(String fragment)
Set the raw fragment.
|
UriBuilder |
rawPath(String path)
Set the raw path.
|
UriBuilder |
rawQuery(String query)
Set the raw query.
|
UriBuilder |
rawUserInfo(String userInfo)
Set the raw user info.
|
UriBuilder |
relativePath(boolean relativePath)
Treat the path as relative.
|
UriBuilder |
removeParameters(String name)
Remove all parameters with the given name.
|
UriBuilder |
scheme(String scheme)
Set the scheme.
|
UriBuilder |
setParameter(String name,
boolean value)
Remove all existing parameters with the given name and add a new
parameter with given name and value.
|
UriBuilder |
setParameter(String name,
int value)
Remove all existing parameters with the given name and add a new
parameter with given name and value.
|
UriBuilder |
setParameter(String name,
long value)
Remove all existing parameters with the given name and add a new
parameter with given name and value.
|
UriBuilder |
setParameter(String name,
String value)
Remove all existing parameters with the given name and add a new
parameter with given name and value.
|
String |
toString()
Returns the content of the URI built so far as a US-ASCII string.
|
URI |
toUri()
Get a URI object of this builder.
|
UriBuilder |
userInfo(String username,
String password)
Set the user info.
|
public static UriBuilder of(URI url)
public static UriBuilder of(URL url)
public static UriBuilder of(String url)
public UriBuilder scheme(String scheme)
scheme - The scheme, e.g. "https" - null to not use a
scheme in the URL.public UriBuilder rawFragment(String fragment)
fragment - The URL-encoded fragment without leading "#" -
null to not use a fragment in the URLpublic UriBuilder fragment(String fragment)
fragment - The non-encoded fragment without leading "#" -
null to not use a fragment in the URLpublic UriBuilder rawUserInfo(String userInfo)
userInfo - The URL-encoded user info, e.g. "username:password" -
null to not use user info in the URLpublic UriBuilder userInfo(String username, String password)
username - The non-URL-encoded usernamepassword - The non-URL-encoded passwordpublic UriBuilder host(String host)
host - The host, e.g. "www.haufe-lexware.com" -
null to not use a host in the URLpublic UriBuilder port(int port)
port - The port, e.g. 8080 -
-1 to not use a port in the URLpublic UriBuilder rawPath(String path)
path - The URL-encoded path, e.g. "/mypath" -
null to not use a path in the URLpublic UriBuilder appendRawPath(String path)
path - The URL-encoded path, e.g. "/mypath".public UriBuilder relativePath(boolean relativePath)
public UriBuilder absolutePath(boolean absolutePath)
public UriBuilder pathComponent(String path)
path - The path component non-URL-escapedpublic UriBuilder pathComponents(String... paths)
paths - The path components non-URL-escapedpublic UriBuilder rawQuery(String query)
query - The URL-encoded query without leading "?", e.g.
"key=value&x=y" - null to not use a query in the URLpublic UriBuilder addParameter(String name, String value)
name - The parameter key, non-URL-encodedvalue - The parameter value, non-URL-encoded, may be nullpublic UriBuilder addParameter(String name, int value)
name - The parameter key, non-URL-encodedvalue - The parameter valuepublic UriBuilder addParameter(String name, long value)
name - The parameter key, non-URL-encodedvalue - The parameter valuepublic UriBuilder addParameter(String name, boolean value)
name - The parameter key, non-URL-encodedvalue - The parameter valuepublic UriBuilder addParameters(Map<String,String> parameters)
parameters - A map of non-URL-encoded keys to non-URL-encoded valuespublic UriBuilder removeParameters(String name)
public UriBuilder setParameter(String name, String value)
public UriBuilder setParameter(String name, int value)
public UriBuilder setParameter(String name, long value)
public UriBuilder setParameter(String name, boolean value)
public String getScheme()
null if the scheme is undefined.public String getRawUserInfo()
null if the user info is undefinedpublic String getHost()
null if the host is undefinedpublic int getPort()
-1 if the port is undefined.public String getRawPath()
null if the path is undefinedpublic List<String> getPathComponents()
null.public boolean isAbsolutePath()
true if the path is absolute. In case of an
undefined path, the return value of this method is undefined.true if the path is absolute. In case of an
undefined path, the return value of this method is undefined.public boolean isRelativePath()
true if the path is relative. In case of an
undefined path, the return value of this method is undefined.true if the path is relative. In case of an
undefined path, the return value of this method is undefined.public String getFragment()
null if the fragment is undefinedpublic String getRawFragment()
null if the fragment is undefinedpublic String getRawQuery()
null if the query is undefinedpublic String getParameterValue(String name)
null may indicate two different things: "?name")public List<String> getParameterValues(String name)
null, but may contain null values
(e.g. for a query like "?name").public Set<String> getParameterNames()
null.public URI toUri()
public URI build()
public String toString()
public String getHostWithoutPath()
Copyright © 2013–2019 mklinger GmbH. All rights reserved.