|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.ws.rs.core.UriBuilder
org.jboss.resteasy.specimpl.UriBuilderImpl
public class UriBuilderImpl
| Constructor Summary | |
|---|---|
UriBuilderImpl()
|
|
| Method Summary | |
|---|---|
java.net.URI |
build(java.lang.Object... values)
Build a URI, using the supplied values in order to replace any URI template parameters. |
java.net.URI |
buildFromEncoded(java.lang.Object... values)
Build a URI. |
java.net.URI |
buildFromEncodedMap(java.util.Map<java.lang.String,? extends java.lang.Object> values)
Build a URI, any URI template parameters will be replaced by the value in the supplied map. |
java.net.URI |
buildFromMap(java.util.Map<java.lang.String,? extends java.lang.Object> values)
Build a URI, any URI template parameters will be replaced by the value in the supplied map. |
java.net.URI |
buildFromMap(java.util.Map<java.lang.String,? extends java.lang.Object> paramMap,
boolean isEncoded)
|
protected java.net.URI |
buildFromValues(boolean encoded,
java.lang.Object... values)
|
UriBuilder |
clone()
Create a copy of the UriBuilder preserving its state. |
protected java.util.regex.Matcher |
createUriParamMatcher(java.lang.String string)
|
UriBuilder |
fragment(java.lang.String fragment)
Set the URI fragment. |
java.lang.String |
getFragment()
|
java.lang.String |
getHost()
|
java.lang.String |
getPath()
|
java.util.List<java.lang.String> |
getPathParamNamesInDeclarationOrder()
Return a unique order list of path params |
int |
getPort()
|
java.lang.String |
getQuery()
|
java.lang.String |
getScheme()
|
java.lang.String |
getUserInfo()
|
UriBuilder |
host(java.lang.String host)
Set the URI host. |
UriBuilder |
matrixParam(java.lang.String name,
java.lang.Object... values)
Append a matrix parameter to the existing set of matrix parameters of the current final segment of the URI path. |
UriBuilder |
path(java.lang.Class resource)
Append the path from a Path-annotated class to the existing path. |
UriBuilder |
path(java.lang.Class resource,
java.lang.String method)
Append the path from a Path-annotated method to the existing path. |
UriBuilder |
path(java.lang.reflect.Method method)
Append the path from a Path-annotated method to the
existing path. |
UriBuilder |
path(java.lang.String segment)
Append path to the existing path. |
protected static java.lang.String |
paths(boolean encode,
java.lang.String basePath,
java.lang.String... segments)
|
UriBuilder |
port(int port)
Set the URI port. |
UriBuilder |
queryParam(java.lang.String name,
java.lang.Object... values)
Append a query parameter to the existing set of query parameters. |
UriBuilder |
replaceMatrix(java.lang.String matrix)
Set the matrix parameters of the current final segment of the current URI path. |
UriBuilder |
replaceMatrixParam(java.lang.String name,
java.lang.Object... values)
Replace the existing value(s) of a matrix parameter on the current final segment of the URI path. |
protected java.lang.StringBuffer |
replaceParameter(java.util.Map<java.lang.String,? extends java.lang.Object> paramMap,
boolean isEncoded,
java.lang.String string,
java.lang.StringBuffer buffer)
|
protected java.lang.StringBuffer |
replaceParameter(java.lang.String name,
java.lang.String value,
boolean isEncoded,
java.lang.String string,
java.lang.StringBuffer buffer)
|
UriBuilder |
replacePath(java.lang.String path)
Set the URI path. |
UriBuilder |
replaceQuery(java.lang.String query)
Set the URI query string. |
UriBuilder |
replaceQueryParam(java.lang.String name,
java.lang.Object... values)
Replace the existing value(s) of a query parameter. |
UriBuilder |
scheme(java.lang.String scheme)
Set the URI scheme. |
UriBuilder |
schemeSpecificPart(java.lang.String ssp)
Set the URI scheme-specific-part (see URI). |
UriBuilder |
segment(java.lang.String... segments)
Append path segments to the existing path. |
UriBuilder |
substitutePathParam(java.lang.String name,
java.lang.Object value,
boolean isEncoded)
Only replace path params in path of URI. |
UriBuilder |
uri(java.net.URI uri)
Copies the non-null components of the supplied URI to the UriBuilder replacing any existing values for those components. |
UriBuilder |
uriTemplate(java.lang.String uriTemplate)
Must follow the patter scheme://host:port/path?query#fragment port, path, query and fragment are optional. |
UriBuilder |
userInfo(java.lang.String ui)
Set the URI user-info. |
| Methods inherited from class javax.ws.rs.core.UriBuilder |
|---|
fromPath, fromResource, fromUri, fromUri, newInstance |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UriBuilderImpl()
| Method Detail |
|---|
public UriBuilder clone()
UriBuilderUriBuilder.build(java.lang.Object...) method.
clone in class UriBuilderpublic UriBuilder uriTemplate(java.lang.String uriTemplate)
uriTemplate -
public UriBuilder uri(java.net.URI uri)
throws java.lang.IllegalArgumentException
UriBuilder
uri in class UriBuilderuri - the URI to copy components from
java.lang.IllegalArgumentException - if uri is null
public UriBuilder scheme(java.lang.String scheme)
throws java.lang.IllegalArgumentException
UriBuilder
scheme in class UriBuilderscheme - the URI scheme, may contain URI template parameters.
A null value will unset the URI scheme.
java.lang.IllegalArgumentException - if scheme is invalid
public UriBuilder schemeSpecificPart(java.lang.String ssp)
throws java.lang.IllegalArgumentException
UriBuilderURI). This
method will overwrite any existing
values for authority, user-info, host, port and path.
schemeSpecificPart in class UriBuilderssp - the URI scheme-specific-part, may contain URI template parameters
java.lang.IllegalArgumentException - if ssp cannot be parsed or is nullpublic UriBuilder userInfo(java.lang.String ui)
UriBuilder
userInfo in class UriBuilderui - the URI user-info, may contain URI template parameters.
A null value will unset userInfo component of the URI.
public UriBuilder host(java.lang.String host)
throws java.lang.IllegalArgumentException
UriBuilder
host in class UriBuilderhost - the URI host, may contain URI template parameters.
A null value will unset the host component of the URI.
java.lang.IllegalArgumentException - if host is invalid.
public UriBuilder port(int port)
throws java.lang.IllegalArgumentException
UriBuilder
port in class UriBuilderport - the URI port, a value of -1 will unset an explicit port.
java.lang.IllegalArgumentException - if port is invalid
protected static java.lang.String paths(boolean encode,
java.lang.String basePath,
java.lang.String... segments)
public UriBuilder path(java.lang.String segment)
throws java.lang.IllegalArgumentException
UriBuilder
path in class UriBuildersegment - the path, may contain URI template parameters
java.lang.IllegalArgumentException - if path is null
public UriBuilder path(java.lang.Class resource)
throws java.lang.IllegalArgumentException
UriBuilder
path in class UriBuilderresource - a resource whose Path value will be
used to obtain the path to append.
java.lang.IllegalArgumentException - if resource is null, or
if resource is not annotated with Path
public UriBuilder path(java.lang.Class resource,
java.lang.String method)
throws java.lang.IllegalArgumentException
UriBuilderpath(Method), it
can only be used in cases where there is a single method with the
specified name that is annotated with Path.
path in class UriBuilderresource - the resource containing the methodmethod - the name of the method whose Path value will be
used to obtain the path to append
java.lang.IllegalArgumentException - if resource or method is null,
or there is more than or less than one variant of the method annotated with
Path
public UriBuilder path(java.lang.reflect.Method method)
throws java.lang.IllegalArgumentException
UriBuilderPath-annotated method to the
existing path.
When constructing the final path, a '/' separator will be inserted
between the existing path and the supplied path if necessary.
path in class UriBuildermethod - a method whose Path value will be
used to obtain the path to append to the existing path
java.lang.IllegalArgumentException - if method is null or is
not annotated with a Path
public UriBuilder replaceMatrix(java.lang.String matrix)
throws java.lang.IllegalArgumentException
UriBuilder
replaceMatrix in class UriBuildermatrix - the matrix parameters, may contain URI template parameters.
A null value will remove all matrix parameters of the current final segment
of the current URI path.
java.lang.IllegalArgumentException - if matrix cannot be parsed
public UriBuilder replaceQuery(java.lang.String query)
throws java.lang.IllegalArgumentException
UriBuilder
replaceQuery in class UriBuilderquery - the URI query string, may contain URI template parameters.
A null value will remove all query parameters.
java.lang.IllegalArgumentException - if query cannot be parsed
public UriBuilder fragment(java.lang.String fragment)
throws java.lang.IllegalArgumentException
UriBuilder
fragment in class UriBuilderfragment - the URI fragment, may contain URI template parameters.
A null value will remove any existing fragment.
java.lang.IllegalArgumentException
public UriBuilder substitutePathParam(java.lang.String name,
java.lang.Object value,
boolean isEncoded)
name - value - isEncoded -
public java.net.URI buildFromMap(java.util.Map<java.lang.String,? extends java.lang.Object> values)
throws java.lang.IllegalArgumentException,
UriBuilderException
UriBuilderString using
their toString method and are then encoded to match the
rules of the URI component to which they pertain. All '%' characters
in the stringified values will be encoded.
The state of the builder is unaffected; this method may be called
multiple times on the same builder instance.
buildFromMap in class UriBuildervalues - a map of URI template parameter names and values
java.lang.IllegalArgumentException - if there are any URI template parameters
without a supplied value, or if a template parameter value is null.
UriBuilderException - if a URI cannot be constructed based on the
current state of the builder.
public java.net.URI buildFromEncodedMap(java.util.Map<java.lang.String,? extends java.lang.Object> values)
throws java.lang.IllegalArgumentException,
UriBuilderException
UriBuilderString using
their toString method and are then encoded to match the
rules of the URI component to which they pertain. All % characters in
the stringified values that are not followed by two hexadecimal numbers
will be encoded.
The state of the builder is unaffected; this method may be called
multiple times on the same builder instance.
buildFromEncodedMap in class UriBuildervalues - a map of URI template parameter names and values
java.lang.IllegalArgumentException - if there are any URI template parameters
without a supplied value, or if a template parameter value is null.
UriBuilderException - if a URI cannot be constructed based on the
current state of the builder.
public java.net.URI buildFromMap(java.util.Map<java.lang.String,? extends java.lang.Object> paramMap,
boolean isEncoded)
throws java.lang.IllegalArgumentException,
UriBuilderException
java.lang.IllegalArgumentException
UriBuilderException
protected java.lang.StringBuffer replaceParameter(java.lang.String name,
java.lang.String value,
boolean isEncoded,
java.lang.String string,
java.lang.StringBuffer buffer)
protected java.util.regex.Matcher createUriParamMatcher(java.lang.String string)
protected java.lang.StringBuffer replaceParameter(java.util.Map<java.lang.String,? extends java.lang.Object> paramMap,
boolean isEncoded,
java.lang.String string,
java.lang.StringBuffer buffer)
public java.util.List<java.lang.String> getPathParamNamesInDeclarationOrder()
public java.net.URI build(java.lang.Object... values)
throws java.lang.IllegalArgumentException,
UriBuilderException
UriBuilderString using
their toString method and are then encoded to match the
rules of the URI component to which they pertain. All '%' characters
in the stringified values will be encoded.
The state of the builder is unaffected; this method may be called
multiple times on the same builder instance.
All instances of the same template parameter will be replaced by the same value that corresponds to the position of the first instance of the template parameter. e.g. the template "{a}/{b}/{a}" with values {"x", "y", "z"} will result in the the URI "x/y/x", not "x/y/z".
build in class UriBuildervalues - a list of URI template parameter values
java.lang.IllegalArgumentException - if there are any URI template parameters
without a supplied value, or if a value is null.
UriBuilderException - if a URI cannot be constructed based on the
current state of the builder.
protected java.net.URI buildFromValues(boolean encoded,
java.lang.Object... values)
public UriBuilder matrixParam(java.lang.String name,
java.lang.Object... values)
throws java.lang.IllegalArgumentException
UriBuilder
matrixParam in class UriBuildername - the matrix parameter name, may contain URI template parametersvalues - the matrix parameter value(s), each object will be converted
to a String using its toString() method. Stringified
values may contain URI template parameters.
java.lang.IllegalArgumentException - if name or values is null
public UriBuilder replaceMatrixParam(java.lang.String name,
java.lang.Object... values)
throws java.lang.IllegalArgumentException
UriBuilder
replaceMatrixParam in class UriBuildername - the matrix parameter name, may contain URI template parametersvalues - the matrix parameter value(s), each object will be converted
to a String using its toString() method. Stringified
values may contain URI template parameters. If values is empty
or null then all current values of the parameter are removed.
java.lang.IllegalArgumentException - if name is null.
public UriBuilder queryParam(java.lang.String name,
java.lang.Object... values)
throws java.lang.IllegalArgumentException
UriBuilder
queryParam in class UriBuildername - the query parameter name, may contain URI template parametersvalues - the query parameter value(s), each object will be converted
to a String using its toString() method. Stringified
values may contain URI template parameters.
java.lang.IllegalArgumentException - if name or values is null
public UriBuilder replaceQueryParam(java.lang.String name,
java.lang.Object... values)
throws java.lang.IllegalArgumentException
UriBuilder
replaceQueryParam in class UriBuildername - the query parameter name, may contain URI template parametersvalues - the query parameter value(s), each object will be converted
to a String using its toString() method. Stringified
values may contain URI template parameters. If values is empty
or null then all current values of the parameter are removed.
java.lang.IllegalArgumentException - if name is nullpublic java.lang.String getHost()
public java.lang.String getScheme()
public int getPort()
public java.lang.String getUserInfo()
public java.lang.String getPath()
public java.lang.String getQuery()
public java.lang.String getFragment()
public UriBuilder segment(java.lang.String... segments)
throws java.lang.IllegalArgumentException
UriBuilder
segment in class UriBuildersegments - the path segment values, each may contain URI template
parameters
java.lang.IllegalArgumentException - if segments or any element of segments
is null
public java.net.URI buildFromEncoded(java.lang.Object... values)
throws java.lang.IllegalArgumentException,
UriBuilderException
UriBuilderString using
their toString method and are then encoded to match the
rules of the URI component to which they pertain. All % characters in
the stringified values that are not followed by two hexadecimal numbers
will be encoded.
The state of the builder is unaffected; this method may be called
multiple times on the same builder instance.
All instances of the same template parameter will be replaced by the same value that corresponds to the position of the first instance of the template parameter. e.g. the template "{a}/{b}/{a}" with values {"x", "y", "z"} will result in the the URI "x/y/x", not "x/y/z".
buildFromEncoded in class UriBuildervalues - a list of URI template parameter values
java.lang.IllegalArgumentException - if there are any URI template parameters
without a supplied value, or if a value is null.
UriBuilderException - if a URI cannot be constructed based on the
current state of the builder.public UriBuilder replacePath(java.lang.String path)
UriBuilder
replacePath in class UriBuilderpath - the path, may contain URI template parameters.
A null value will unset the path component of the URI.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||