|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.ws.rs.core.UriBuilder
@Contract public abstract class UriBuilder
URI template aware utility class for building URIs from their components. See
UriTemplate.value()
for an explanation of URI templates.
URI
,
UriTemplate
Constructor Summary | |
---|---|
UriBuilder()
|
Method Summary | |
---|---|
abstract UriBuilder |
authority(java.lang.String authority)
Set the URI authority. |
abstract java.net.URI |
build()
Build a URI, any URI template parameters will be replaced by the empty string. |
abstract java.net.URI |
build(java.util.Map<java.lang.String,java.lang.String> values)
Build a URI, any URI template parameters will be replaced by the value in the supplied map. |
abstract java.net.URI |
build(java.lang.String... values)
Build a URI, using the supplied values in order to replace any URI template parameters. |
UriBuilder |
fragment(java.lang.String fragment)
Set the URI fragment using an unencoded value, equivalent to fragment(fragment, true) . |
abstract UriBuilder |
fragment(java.lang.String fragment,
boolean encode)
Set the URI fragment. |
static UriBuilder |
fromPath(java.lang.String path)
Create a new instance initialized from an unencoded URI path, equivalent to fromPath(path, true) . |
static UriBuilder |
fromPath(java.lang.String path,
boolean encode)
Create a new instance initialized from a URI path. |
static UriBuilder |
fromResource(java.lang.Class resource)
Create a new instance initialized from a root resource class. |
static UriBuilder |
fromUri(java.net.URI uri)
Create a new instance initialized from an existing URI. |
abstract UriBuilder |
host(java.lang.String host)
Set the URI host. |
UriBuilder |
matrixParam(java.lang.String name,
java.lang.String value)
Append a matrix parameter to the existing set of matrix parameters of the final segment of the current URI path, equivalent to matrixParam(name, value, true) . |
abstract UriBuilder |
matrixParam(java.lang.String name,
java.lang.String value,
boolean encode)
Append a matrix parameter to the existing set of matrix parameters of the final segment of the current URI path. |
protected static UriBuilder |
newInstance()
Creates a new instance of UriBuilder |
abstract UriBuilder |
path(boolean encode,
java.lang.String... segments)
Append path segments to the existing list of segments. |
abstract UriBuilder |
path(java.lang.Class resource)
Append path segments to the existing list of segments. |
UriBuilder |
path(java.lang.String... segments)
Append unencoded path segments to the existing list of segments, equivalent to path(true, segments) . |
abstract UriBuilder |
port(int port)
Set the URI port. |
UriBuilder |
queryParam(java.lang.String name,
java.lang.String value)
Append a query parameter to the existing set of query parameters, equivalent to queryParam(name, value, true) . |
abstract UriBuilder |
queryParam(java.lang.String name,
java.lang.String value,
boolean encode)
Append a query parameter to the existing set of query parameters. |
UriBuilder |
replaceMatrixParams(java.lang.String matrix)
Set the matrix parameters of the final segment of the current URI path using an unencoded value, equivalent to replaceMatrixParams(matrix, true) . |
abstract UriBuilder |
replaceMatrixParams(java.lang.String matrix,
boolean encode)
Set the matrix parameters of the final segment of the current URI path. |
UriBuilder |
replacePath(java.lang.String path)
Set the URI path using an unencoded value, equivalent to replacePath(path, true) . |
abstract UriBuilder |
replacePath(java.lang.String path,
boolean encode)
Set the URI path. |
UriBuilder |
replaceQueryParams(java.lang.String query)
Set the URI query string using an unencoded value, equivalent to replaceQueryParams(query, true) . |
abstract UriBuilder |
replaceQueryParams(java.lang.String query,
boolean encode)
Set the URI query string. |
abstract UriBuilder |
scheme(java.lang.String scheme)
Set the URI scheme. |
abstract UriBuilder |
schemeSpecificPart(java.lang.String ssp)
Set the URI scheme-specific-part. |
abstract UriBuilder |
uri(java.net.URI uri)
Copies the non-null components of the supplied URI to the UriBuilder. |
UriBuilder |
userInfo(java.lang.String ui)
Set the URI user-info using an unencoded value. |
abstract UriBuilder |
userInfo(java.lang.String ui,
boolean encode)
Set the URI user-info. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UriBuilder()
Method Detail |
---|
protected static UriBuilder newInstance()
public static UriBuilder fromUri(java.net.URI uri)
uri
- a URI that will be used to initialize the UriBuilder.
public static UriBuilder fromPath(java.lang.String path)
fromPath(path, true)
.
path
- a URI path that will be used to initialize the UriBuilder.
public static UriBuilder fromPath(java.lang.String path, boolean encode)
path
- a URI path that will be used to initialize the UriBuilder.encode
- controls whether the supplied value is automatically encoded
(true) or not (false). If false, the value must be valid with all illegal
characters already escaped.
public static UriBuilder fromResource(java.lang.Class resource)
resource
- a root resource whose @UriTemplate value will be used
to initialize the UriBuilder.
public abstract UriBuilder uri(java.net.URI uri)
uri
- the URI to copy components from
public abstract UriBuilder scheme(java.lang.String scheme)
scheme
- the URI scheme
public abstract UriBuilder schemeSpecificPart(java.lang.String ssp)
ssp
- the URI scheme-specific-part
public abstract UriBuilder authority(java.lang.String authority)
authority
- the URI authority
public UriBuilder userInfo(java.lang.String ui)
userInfo(ui, true)
.
ui
- the URI user-info
public abstract UriBuilder userInfo(java.lang.String ui, boolean encode)
ui
- the URI user-infoencode
- controls whether the supplied value is automatically encoded
(true) or not (false). If false, the value must be valid with all illegal
characters already escaped.
public abstract UriBuilder host(java.lang.String host)
host
- the URI host
public abstract UriBuilder port(int port)
port
- the URI port
public UriBuilder replacePath(java.lang.String path)
replacePath(path, true)
. This method will overwrite
any existing path segments.
path
- the URI path, may contain URI template parameters
public abstract UriBuilder replacePath(java.lang.String path, boolean encode)
path
- the URI path, may contain URI template parametersencode
- controls whether the supplied value is automatically encoded
(true) or not (false). If false, the value must be valid with all illegal
characters already escaped.
public UriBuilder path(java.lang.String... segments)
path(true, segments)
. When constructing
the final path, each segment will be separated by '/' if necessary.
segments
- the path segments, may contain URI template parameters
public abstract UriBuilder path(boolean encode, java.lang.String... segments)
segments
- the path segments, may contain URI template parametersencode
- controls whether the supplied values are automatically encoded
(true) or not (false). If false, the values must be valid with all illegal
characters already escaped.
public abstract UriBuilder path(java.lang.Class resource)
resource
- a root resource whose @UriTemplate value will be used to
obtain the path segments
public UriBuilder replaceMatrixParams(java.lang.String matrix)
replaceMatrixParams(matrix, true)
.
This method will overwrite any existing matrix parameters on the final
segment of the current URI path.
matrix
- the matrix parameters, may contain URI template parameters
public abstract UriBuilder replaceMatrixParams(java.lang.String matrix, boolean encode)
matrix
- the matrix parameters, may contain URI template parametersencode
- controls whether the supplied value is automatically encoded
(true) or not (false). If false, the value must be valid with all illegal
characters already escaped.
public UriBuilder matrixParam(java.lang.String name, java.lang.String value)
matrixParam(name, value, true)
.
name
- the matrix parameter name, may contain URI template parametersvalue
- the matrix parameter value, may contain URI template parameters
public abstract UriBuilder matrixParam(java.lang.String name, java.lang.String value, boolean encode)
name
- the matrix parameter name, may contain URI template parametersvalue
- the matrix parameter value, may contain URI template parametersencode
- controls whether the supplied name and value are automatically encoded
(true) or not (false). If false, the name and value must be valid with all illegal
characters already escaped.
public UriBuilder replaceQueryParams(java.lang.String query)
replaceQueryParams(query, true)
. This method will overwrite any existing query
parameters.
query
- the URI query string
public abstract UriBuilder replaceQueryParams(java.lang.String query, boolean encode)
query
- the URI query stringencode
- controls whether the supplied value is automatically encoded
(true) or not (false). If false, the value must be valid with all illegal
characters already escaped.
public UriBuilder queryParam(java.lang.String name, java.lang.String value)
queryParam(name, value, true)
.
name
- the query parameter name, may contain URI template parametersvalue
- the query parameter value, may contain URI template parameters
public abstract UriBuilder queryParam(java.lang.String name, java.lang.String value, boolean encode)
name
- the query parameter name, may contain URI template parametersvalue
- the query parameter value, may contain URI template parametersencode
- controls whether the supplied name and value are automatically encoded
(true) or not (false). If false, the name and value must be valid with all illegal
characters already escaped.
public UriBuilder fragment(java.lang.String fragment)
fragment(fragment, true)
.
fragment
- the URI fragment
public abstract UriBuilder fragment(java.lang.String fragment, boolean encode)
fragment
- the URI fragmentencode
- controls whether the supplied value is automatically encoded
(true) or not (false). If false, the value must be valid with all illegal
characters already escaped.
public abstract java.net.URI build()
public abstract java.net.URI build(java.util.Map<java.lang.String,java.lang.String> values)
values
- a map of URI template parameter names and values
public abstract java.net.URI build(java.lang.String... values)
values
- a list of URI template parameter values
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |