@Deprecated public class ExtendedUriBuilder extends AbstractUriBuilder
UriBuilder
extension provides special help for "file"
extensions. They will not be removed, if path will be changed (e.g. replaced,
removed or matrix parameters added). For further information see
extension(String)
, extensionLanguage(String)
and
extensionMedia(String)
. You could get an instance with an
ExtendedUriInfo
.Constructor and Description |
---|
ExtendedUriBuilder()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
java.net.URI |
build(java.lang.Object... values)
Deprecated.
Build a URI, using the supplied values in order to replace any URI
template parameters.
|
java.net.URI |
buildFromEncoded(java.lang.Object... values)
Deprecated.
|
java.net.URI |
buildFromEncodedMap(java.util.Map<java.lang.String,? extends java.lang.Object> values)
Deprecated.
|
java.net.URI |
buildFromMap(java.util.Map<java.lang.String,? extends java.lang.Object> values)
Deprecated.
|
ExtendedUriBuilder |
clone()
Deprecated.
|
ExtendedUriBuilder |
extension(java.lang.String extensions)
Deprecated.
Set the extension that will be appended to the final path segment at
build time.
|
ExtendedUriBuilder |
extensionLanguage(java.lang.String language)
Deprecated.
Appends an extension for the language ("de", "en", "fr" or whatever).
|
ExtendedUriBuilder |
extensionMedia(java.lang.String mediaExtension)
Deprecated.
Appends an extension for the media type ("html", "pdf", "gif" or
whatever).
|
ExtendedUriBuilder |
fragment(java.lang.String fragment)
Deprecated.
Set the URI fragment using an unencoded value.
|
static ExtendedUriBuilder |
fromPath(java.lang.String path)
Deprecated.
Create a new instance representing a relative URI initialized from a URI
path.
|
static ExtendedUriBuilder |
fromResource(java.lang.Class<?> resource)
Deprecated.
Create a new instance representing a relative URI initialized from a root
resource class.
|
static ExtendedUriBuilder |
fromUri(java.lang.String uri)
Deprecated.
Create a new instance initialized from an existing URI.
|
static ExtendedUriBuilder |
fromUri(java.net.URI uri)
Deprecated.
Create a new instance initialized from an existing URI.
|
java.lang.String |
getExtension()
Deprecated.
Returns the extension of the current uri, if available.
|
ExtendedUriBuilder |
host(java.lang.String host)
Deprecated.
Set the URI host.
|
ExtendedUriBuilder |
matrixParam(java.lang.String name,
java.lang.Object... values)
Deprecated.
Append a matrix parameter to the existing set of matrix parameters of the
current final segment of the URI path.
|
static ExtendedUriBuilder |
newInstance()
Deprecated.
Creates a new instance of UriBuilder.
|
ExtendedUriBuilder |
path(java.lang.Class resource)
Deprecated.
Append path segments from a Path-annotated class to the existing list of
segments.
|
ExtendedUriBuilder |
path(java.lang.Class resource,
java.lang.String methodName)
Deprecated.
Append path segments from a Path-annotated method to the existing list of
segments.
|
ExtendedUriBuilder |
path(java.lang.reflect.Method method)
Deprecated.
Append the path from a
Path -annotated method to the
existing path. |
ExtendedUriBuilder |
path(java.lang.String pathToAppend)
Deprecated.
Append path to the existing path.
|
ExtendedUriBuilder |
port(int port)
Deprecated.
Set the URI port.
|
ExtendedUriBuilder |
port(java.lang.String port)
Deprecated.
Set the URI port.
|
ExtendedUriBuilder |
queryParam(java.lang.String name,
java.lang.Object... values)
Deprecated.
Append a query parameter to the existing set of query parameters.
|
ExtendedUriBuilder |
replaceMatrix(java.lang.String matrix)
Deprecated.
Set the matrix parameters of the current final segment of the current URI
path.
|
ExtendedUriBuilder |
replaceMatrixParam(java.lang.String name,
java.lang.Object... values)
Deprecated.
|
ExtendedUriBuilder |
replacePath(java.lang.String newPath)
Deprecated.
Set the URI path.
|
ExtendedUriBuilder |
replaceQuery(java.lang.String query)
Deprecated.
Set the URI query string.
|
ExtendedUriBuilder |
replaceQueryParam(java.lang.String name,
java.lang.Object... values)
Deprecated.
|
ExtendedUriBuilder |
scheme(java.lang.String scheme)
Deprecated.
Set the URI scheme.
|
ExtendedUriBuilder |
schemeSpecificPart(java.lang.String ssp)
Deprecated.
Set the URI scheme-specific-part (see
URI ). |
ExtendedUriBuilder |
segment(java.lang.String... segments)
Deprecated.
Append path segments to the existing path.
|
java.lang.String |
toString()
Deprecated.
Returns the actual URI as String.
|
ExtendedUriBuilder |
uri(java.net.URI uri)
Deprecated.
Copies the non-null components of the supplied URI to the UriBuilder
replacing any existing values for those components.
|
ExtendedUriBuilder |
userInfo(java.lang.String ui)
Deprecated.
Set the URI user-info.
|
copyInto, path, replacePath
public static ExtendedUriBuilder fromPath(java.lang.String path) throws java.lang.IllegalArgumentException
path
- a URI path that will be used to initialize the UriBuilder, may
contain URI template parameters.java.lang.IllegalArgumentException
- if path is nullpublic static ExtendedUriBuilder fromResource(java.lang.Class<?> resource) throws java.lang.IllegalArgumentException
resource
- a root resource whose Path
value will be
used to initialize the UriBuilder.java.lang.IllegalArgumentException
- if resource is not annotated with Path
or
resource is null.public static ExtendedUriBuilder fromUri(java.lang.String uri) throws java.lang.IllegalArgumentException
uri
- a URI that will be used to initialize the UriBuilder, may not
contain URI parameters.java.lang.IllegalArgumentException
- if uri is not a valid URI or is nullpublic static ExtendedUriBuilder fromUri(java.net.URI uri) throws java.lang.IllegalArgumentException
uri
- a URI that will be used to initialize the UriBuilder.java.lang.IllegalArgumentException
- if uri is nullpublic static ExtendedUriBuilder newInstance()
public java.net.URI build(java.lang.Object... values) throws java.lang.IllegalArgumentException, javax.ws.rs.core.UriBuilderException
String
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 AbstractUriBuilder
values
- a list of URI template parameter valuesjava.lang.IllegalArgumentException
- if there are any URI template parameters without a supplied
value, or if a value is null.javax.ws.rs.core.UriBuilderException
- if a URI cannot be constructed based on the current state of
the builder.UriBuilder.build(java.lang.Object[])
public java.net.URI buildFromEncoded(java.lang.Object... values) throws java.lang.IllegalArgumentException, javax.ws.rs.core.UriBuilderException
buildFromEncoded
in class AbstractUriBuilder
java.lang.IllegalArgumentException
javax.ws.rs.core.UriBuilderException
UriBuilder.buildFromEncoded(java.lang.Object[])
public java.net.URI buildFromEncodedMap(java.util.Map<java.lang.String,? extends java.lang.Object> values) throws java.lang.IllegalArgumentException, javax.ws.rs.core.UriBuilderException
buildFromEncodedMap
in class AbstractUriBuilder
java.lang.IllegalArgumentException
javax.ws.rs.core.UriBuilderException
UriBuilder.buildFromEncodedMap(java.util.Map)
public java.net.URI buildFromMap(java.util.Map<java.lang.String,? extends java.lang.Object> values) throws java.lang.IllegalArgumentException, javax.ws.rs.core.UriBuilderException
buildFromMap
in class AbstractUriBuilder
java.lang.IllegalArgumentException
javax.ws.rs.core.UriBuilderException
UriBuilder.buildFromMap(java.util.Map)
public ExtendedUriBuilder clone()
clone
in class javax.ws.rs.core.UriBuilder
public ExtendedUriBuilder extension(java.lang.String extensions)
Note that the extension will be appended to the path component, matrix and query parameters will follow any appended extension.
extensions
- the extensions to append at build time, a null value will
result in no extension being appended.public ExtendedUriBuilder extensionLanguage(java.lang.String language)
null
resets the language extension.language
- ExtendedUriBuilder
public ExtendedUriBuilder extensionMedia(java.lang.String mediaExtension)
null
resets the media type extension.mediaExtension
- public ExtendedUriBuilder fragment(java.lang.String fragment)
fragment
in class AbstractUriBuilder
fragment
- the URI fragment, may contain URI template parametersUriBuilder.fragment(java.lang.String)
public java.lang.String getExtension()
getExtension
in class AbstractUriBuilder
null
if no extension is available. Never
returns "" or ".".public ExtendedUriBuilder host(java.lang.String host) throws java.lang.IllegalArgumentException
host
in class AbstractUriBuilder
host
- the URI host, may contain URI template parametersjava.lang.IllegalArgumentException
- if host is invalid or is nullUriBuilder.host(java.lang.String)
public ExtendedUriBuilder matrixParam(java.lang.String name, java.lang.Object... values) throws java.lang.IllegalArgumentException
matrixParam
in class AbstractUriBuilder
name
- 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 value is null, or if automatic encoding is
disabled and the name or any stringified value contains
illegal charactersUriBuilder.matrixParam(String, Object...)
public ExtendedUriBuilder path(java.lang.Class resource) throws java.lang.IllegalArgumentException
Path
but it will not be used to modify the state of
automatic encoding for the builder.path
in class AbstractUriBuilder
resource
- a resource whose @Path value will be used to obtain the
path segment.java.lang.IllegalArgumentException
- if resource is null, or if resource.encode is false and
resource.value contains illegal characters, or if resource is
not annotated with UrPathUriBuilder.path(java.lang.Class)
public ExtendedUriBuilder path(java.lang.Class resource, java.lang.String methodName) throws java.lang.IllegalArgumentException
path(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 AbstractUriBuilder
resource
- the root resource class containing the method.methodName
- the name of the method whose @Path
value will be
used to obtain the path segment.java.lang.IllegalArgumentException
- if resource or method is null, or if the specified method
does not exist, or there is more than or less than one
variant of the method annotated with UriPathUriBuilder.path(java.lang.Class, java.lang.String)
public ExtendedUriBuilder path(java.lang.reflect.Method method) throws java.lang.IllegalArgumentException
Path
-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 AbstractUriBuilder
method
- a method whose Path
value will be used to
obtain the path to append to the existing pathjava.lang.IllegalArgumentException
- if any element of methods is null or is not annotated with a
Path
UriBuilder.path(java.lang.reflect.Method)
public ExtendedUriBuilder path(java.lang.String pathToAppend) throws java.lang.IllegalArgumentException
path
in class AbstractUriBuilder
pathToAppend
- the path to append to the current path, may contain URI
template parametersjava.lang.IllegalArgumentException
- if path is nullUriBuilder.path(java.lang.String)
public ExtendedUriBuilder port(int port) throws java.lang.IllegalArgumentException
port
in class AbstractUriBuilder
port
- the URI port, a value of -1 will unset an explicit port.java.lang.IllegalArgumentException
- if port is invalidUriBuilder.port(int)
public ExtendedUriBuilder port(java.lang.String port) throws java.lang.IllegalArgumentException
port
in class AbstractUriBuilder
port
- the URI port (null will unset an explicit port) or a template
variable.java.lang.IllegalArgumentException
- if given value is invalidAbstractUriBuilder.port(int)
public ExtendedUriBuilder queryParam(java.lang.String name, java.lang.Object... values) throws java.lang.IllegalArgumentException
queryParam
in class AbstractUriBuilder
name
- 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 value is null, or if automatic encoding is
disabled and name or value contains illegal charactersUriBuilder.queryParam(String, Object...)
public ExtendedUriBuilder replaceMatrix(java.lang.String matrix) throws java.lang.IllegalArgumentException
replaceMatrix
in class AbstractUriBuilder
matrix
- 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, or if automatic encoding is
disabled and any matrix parameter name or value contains
illegal charactersUriBuilder.replaceMatrix(String)
public ExtendedUriBuilder replaceMatrixParam(java.lang.String name, java.lang.Object... values) throws java.lang.IllegalArgumentException
replaceMatrixParam
in class AbstractUriBuilder
java.lang.IllegalArgumentException
UriBuilder.replaceMatrixParam(java.lang.String,
java.lang.Object[])
public ExtendedUriBuilder replacePath(java.lang.String newPath)
replacePath
in class AbstractUriBuilder
newPath
- the path to replace the old path with, may contain URI
template parameters. A null value will unset the path
component of the URI.UriBuilder.replacePath(java.lang.String)
public ExtendedUriBuilder replaceQuery(java.lang.String query) throws java.lang.IllegalArgumentException
replaceQuery
in class AbstractUriBuilder
query
- the URI query string, may contain URI template parameters. A
null value will remove all query parameters.java.lang.IllegalArgumentException
- if query cannot be parsedUriBuilder.replaceQuery(java.lang.String)
public ExtendedUriBuilder replaceQueryParam(java.lang.String name, java.lang.Object... values) throws java.lang.IllegalArgumentException
replaceQueryParam
in class AbstractUriBuilder
java.lang.IllegalArgumentException
UriBuilder.replaceQueryParam(String, Object[])
public ExtendedUriBuilder scheme(java.lang.String scheme) throws java.lang.IllegalArgumentException
scheme
in class AbstractUriBuilder
scheme
- the URI scheme, may contain URI template parametersjava.lang.IllegalArgumentException
- if scheme is invalid or is nullUriBuilder.scheme(java.lang.String)
public ExtendedUriBuilder schemeSpecificPart(java.lang.String ssp) throws java.lang.IllegalArgumentException
URI
). This method
will overwrite any existing values for authority, user-info, host, port
and path.schemeSpecificPart
in class AbstractUriBuilder
ssp
- the URI scheme-specific-part, may contain URI template
parametersjava.lang.IllegalArgumentException
- if ssp cannot be parsed or is nullUriBuilder.schemeSpecificPart(java.lang.String)
public ExtendedUriBuilder segment(java.lang.String... segments) throws java.lang.IllegalArgumentException
segment
in class AbstractUriBuilder
segments
- the path segment values, each may contain URI template
parametersjava.lang.IllegalArgumentException
- if segments or any element of segments is nullUriBuilder.segment(java.lang.String[])
public java.lang.String toString()
toString
in class AbstractUriBuilder
AbstractUriBuilder.toStringWithCheck(boolean)
public ExtendedUriBuilder uri(java.net.URI uri) throws java.lang.IllegalArgumentException
uri
in class AbstractUriBuilder
uri
- the URI to copy components fromjava.lang.IllegalArgumentException
- if uri is nullUriBuilder.uri(java.net.URI)
public ExtendedUriBuilder userInfo(java.lang.String ui)
userInfo
in class AbstractUriBuilder
ui
- the URI user-info, may contain URI template parametersUriBuilder.userInfo(java.lang.String)
Copyright © 2005-2024 Restlet.