Package org.restlet.ext.jaxrs
Class ExtendedUriBuilder
- java.lang.Object
-
- javax.ws.rs.core.UriBuilder
-
- org.restlet.ext.jaxrs.AbstractUriBuilder
-
- org.restlet.ext.jaxrs.ExtendedUriBuilder
-
@Deprecated public class ExtendedUriBuilder extends AbstractUriBuilder
Deprecated.Will be removed in next minor release.ThisUriBuilderextension 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 seeextension(String),extensionLanguage(String)andextensionMedia(String). You could get an instance with anExtendedUriInfo.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringextensionLanguageDeprecated.The extension for the languageprivate java.lang.StringextensionMediaDeprecated.The extension for the media typeprivate java.lang.StringextensionOthersDeprecated.Other extensions as language and media type
-
Constructor Summary
Constructors Constructor Description ExtendedUriBuilder()Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.net.URIbuild(java.lang.Object... values)Deprecated.Build a URI, using the supplied values in order to replace any URI template parameters.java.net.URIbuildFromEncoded(java.lang.Object... values)Deprecated.java.net.URIbuildFromEncodedMap(java.util.Map<java.lang.String,? extends java.lang.Object> values)Deprecated.java.net.URIbuildFromMap(java.util.Map<java.lang.String,? extends java.lang.Object> values)Deprecated.ExtendedUriBuilderclone()Deprecated.ExtendedUriBuilderextension(java.lang.String extensions)Deprecated.Set the extension that will be appended to the final path segment at build time.ExtendedUriBuilderextensionLanguage(java.lang.String language)Deprecated.Appends an extension for the language ("de", "en", "fr" or whatever).ExtendedUriBuilderextensionMedia(java.lang.String mediaExtension)Deprecated.Appends an extension for the media type ("html", "pdf", "gif" or whatever).ExtendedUriBuilderfragment(java.lang.String fragment)Deprecated.Set the URI fragment using an unencoded value.static ExtendedUriBuilderfromPath(java.lang.String path)Deprecated.Create a new instance representing a relative URI initialized from a URI path.static ExtendedUriBuilderfromResource(java.lang.Class<?> resource)Deprecated.Create a new instance representing a relative URI initialized from a root resource class.static ExtendedUriBuilderfromUri(java.lang.String uri)Deprecated.Create a new instance initialized from an existing URI.static ExtendedUriBuilderfromUri(java.net.URI uri)Deprecated.Create a new instance initialized from an existing URI.java.lang.StringgetExtension()Deprecated.Returns the extension of the current uri, if available.ExtendedUriBuilderhost(java.lang.String host)Deprecated.Set the URI host.ExtendedUriBuildermatrixParam(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 ExtendedUriBuildernewInstance()Deprecated.Creates a new instance of UriBuilder.ExtendedUriBuilderpath(java.lang.Class resource)Deprecated.Append path segments from a Path-annotated class to the existing list of segments.ExtendedUriBuilderpath(java.lang.Class resource, java.lang.String methodName)Deprecated.Append path segments from a Path-annotated method to the existing list of segments.ExtendedUriBuilderpath(java.lang.reflect.Method method)Deprecated.Append the path from aPath-annotated method to the existing path.ExtendedUriBuilderpath(java.lang.String pathToAppend)Deprecated.Append path to the existing path.ExtendedUriBuilderport(int port)Deprecated.Set the URI port.ExtendedUriBuilderport(java.lang.String port)Deprecated.Set the URI port.ExtendedUriBuilderqueryParam(java.lang.String name, java.lang.Object... values)Deprecated.Append a query parameter to the existing set of query parameters.ExtendedUriBuilderreplaceMatrix(java.lang.String matrix)Deprecated.Set the matrix parameters of the current final segment of the current URI path.ExtendedUriBuilderreplaceMatrixParam(java.lang.String name, java.lang.Object... values)Deprecated.ExtendedUriBuilderreplacePath(java.lang.String newPath)Deprecated.Set the URI path.ExtendedUriBuilderreplaceQuery(java.lang.String query)Deprecated.Set the URI query string.ExtendedUriBuilderreplaceQueryParam(java.lang.String name, java.lang.Object... values)Deprecated.ExtendedUriBuilderscheme(java.lang.String scheme)Deprecated.Set the URI scheme.ExtendedUriBuilderschemeSpecificPart(java.lang.String ssp)Deprecated.Set the URI scheme-specific-part (seeURI).ExtendedUriBuildersegment(java.lang.String... segments)Deprecated.Append path segments to the existing path.java.lang.StringtoString()Deprecated.Returns the actual URI as String.ExtendedUriBuilderuri(java.net.URI uri)Deprecated.Copies the non-null components of the supplied URI to the UriBuilder replacing any existing values for those components.ExtendedUriBuilderuserInfo(java.lang.String ui)Deprecated.Set the URI user-info.-
Methods inherited from class org.restlet.ext.jaxrs.AbstractUriBuilder
copyInto, path, replacePath
-
-
-
-
Field Detail
-
extensionLanguage
private java.lang.String extensionLanguage
Deprecated.The extension for the language
-
extensionMedia
private java.lang.String extensionMedia
Deprecated.The extension for the media type
-
extensionOthers
private java.lang.String extensionOthers
Deprecated.Other extensions as language and media type- See Also:
extensionLanguage,extensionMedia
-
-
Method Detail
-
fromPath
public static ExtendedUriBuilder fromPath(java.lang.String path) throws java.lang.IllegalArgumentException
Deprecated.Create a new instance representing a relative URI initialized from a URI path.- Parameters:
path- a URI path that will be used to initialize the UriBuilder, may contain URI template parameters.- Returns:
- a new UriBuilder
- Throws:
java.lang.IllegalArgumentException- if path is null
-
fromResource
public static ExtendedUriBuilder fromResource(java.lang.Class<?> resource) throws java.lang.IllegalArgumentException
Deprecated.Create a new instance representing a relative URI initialized from a root resource class.- Parameters:
resource- a root resource whosePathvalue will be used to initialize the UriBuilder.- Returns:
- a new UriBuilder
- Throws:
java.lang.IllegalArgumentException- if resource is not annotated withPathor resource is null.
-
fromUri
public static ExtendedUriBuilder fromUri(java.lang.String uri) throws java.lang.IllegalArgumentException
Deprecated.Create a new instance initialized from an existing URI.- Parameters:
uri- a URI that will be used to initialize the UriBuilder, may not contain URI parameters.- Returns:
- a new UriBuilder
- Throws:
java.lang.IllegalArgumentException- if uri is not a valid URI or is null
-
fromUri
public static ExtendedUriBuilder fromUri(java.net.URI uri) throws java.lang.IllegalArgumentException
Deprecated.Create a new instance initialized from an existing URI.- Parameters:
uri- a URI that will be used to initialize the UriBuilder.- Returns:
- a new UriBuilder
- Throws:
java.lang.IllegalArgumentException- if uri is null
-
newInstance
public static ExtendedUriBuilder newInstance()
Deprecated.Creates a new instance of UriBuilder.- Returns:
- a new instance of UriBuilder
-
build
public java.net.URI build(java.lang.Object... values) throws java.lang.IllegalArgumentException, javax.ws.rs.core.UriBuilderExceptionDeprecated.Build a URI, using the supplied values in order to replace any URI template parameters. Values are converted toStringusing theirtoStringmethod 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".
- Overrides:
buildin classAbstractUriBuilder- Parameters:
values- a list of URI template parameter values- Returns:
- the URI built from the UriBuilder
- Throws:
java.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.- See Also:
UriBuilder.build(java.lang.Object[])
-
buildFromEncoded
public java.net.URI buildFromEncoded(java.lang.Object... values) throws java.lang.IllegalArgumentException, javax.ws.rs.core.UriBuilderExceptionDeprecated.- Overrides:
buildFromEncodedin classAbstractUriBuilder- Throws:
java.lang.IllegalArgumentExceptionjavax.ws.rs.core.UriBuilderException- See Also:
UriBuilder.buildFromEncoded(java.lang.Object[])
-
buildFromEncodedMap
public java.net.URI buildFromEncodedMap(java.util.Map<java.lang.String,? extends java.lang.Object> values) throws java.lang.IllegalArgumentException, javax.ws.rs.core.UriBuilderExceptionDeprecated.- Overrides:
buildFromEncodedMapin classAbstractUriBuilder- Throws:
java.lang.IllegalArgumentExceptionjavax.ws.rs.core.UriBuilderException- See Also:
UriBuilder.buildFromEncodedMap(java.util.Map)
-
buildFromMap
public java.net.URI buildFromMap(java.util.Map<java.lang.String,? extends java.lang.Object> values) throws java.lang.IllegalArgumentException, javax.ws.rs.core.UriBuilderExceptionDeprecated.- Overrides:
buildFromMapin classAbstractUriBuilder- Throws:
java.lang.IllegalArgumentExceptionjavax.ws.rs.core.UriBuilderException- See Also:
UriBuilder.buildFromMap(java.util.Map)
-
clone
public ExtendedUriBuilder clone()
Deprecated.- Specified by:
clonein classjavax.ws.rs.core.UriBuilder
-
extension
public ExtendedUriBuilder extension(java.lang.String extensions)
Deprecated.Set the extension that will be appended to the final path segment at build time. An initial "." will be appended if necessary. If the final path segment already contains an extension, it will be retained and the supplied extension will be used as a new extension.Note that the extension will be appended to the path component, matrix and query parameters will follow any appended extension.
- Parameters:
extensions- the extensions to append at build time, a null value will result in no extension being appended.- Returns:
- the updated UriBuilder
-
extensionLanguage
public ExtendedUriBuilder extensionLanguage(java.lang.String language)
Deprecated.Appends an extension for the language ("de", "en", "fr" or whatever).nullresets the language extension.- Parameters:
language-- Returns:
- this
ExtendedUriBuilder
-
extensionMedia
public ExtendedUriBuilder extensionMedia(java.lang.String mediaExtension)
Deprecated.Appends an extension for the media type ("html", "pdf", "gif" or whatever).nullresets the media type extension.- Parameters:
mediaExtension-- Returns:
- this ExtendedUriBuilder
-
fragment
public ExtendedUriBuilder fragment(java.lang.String fragment)
Deprecated.Set the URI fragment using an unencoded value.- Overrides:
fragmentin classAbstractUriBuilder- Parameters:
fragment- the URI fragment, may contain URI template parameters- Returns:
- the updated UriBuilder
- See Also:
UriBuilder.fragment(java.lang.String)
-
getExtension
public java.lang.String getExtension()
Deprecated.Returns the extension of the current uri, if available.- Overrides:
getExtensionin classAbstractUriBuilder- Returns:
- the extension for content negotiation, including a "." at the
start, or
nullif no extension is available. Never returns "" or ".".
-
host
public ExtendedUriBuilder host(java.lang.String host) throws java.lang.IllegalArgumentException
Deprecated.Set the URI host.- Overrides:
hostin classAbstractUriBuilder- Parameters:
host- the URI host, may contain URI template parameters- Returns:
- the updated UriBuilder
- Throws:
java.lang.IllegalArgumentException- if host is invalid or is null- See Also:
UriBuilder.host(java.lang.String)
-
matrixParam
public ExtendedUriBuilder matrixParam(java.lang.String name, java.lang.Object... values) throws java.lang.IllegalArgumentException
Deprecated.Append a matrix parameter to the existing set of matrix parameters of the current final segment of the URI path. If multiple values are supplied the parameter will be added once per value. Note that the matrix parameters are tied to a particular path segment; subsequent addition of path segments will not affect their position in the URI path.- Overrides:
matrixParamin classAbstractUriBuilder- Parameters:
name- the matrix parameter name, may contain URI template parametersvalues- the matrix parameter value(s), each object will be converted to aStringusing itstoString()method. Stringified values may contain URI template parameters.- Returns:
- the updated UriBuilder
- Throws:
java.lang.IllegalArgumentException- if name or value is null, or if automatic encoding is disabled and the name or any stringified value contains illegal characters- See Also:
- Matrix
URIs,
UriBuilder.matrixParam(String, Object...)
-
path
public ExtendedUriBuilder path(java.lang.Class resource) throws java.lang.IllegalArgumentException
Deprecated.Append path segments from a Path-annotated class to the existing list of segments. When constructing the final path, each segment will be separated by '/' if necessary. The value of the encode property of the Path annotation will be used when processing the value of the @Pathbut it will not be used to modify the state of automatic encoding for the builder.- Overrides:
pathin classAbstractUriBuilder- Parameters:
resource- a resource whose @Path value will be used to obtain the path segment.- Returns:
- the updated UriBuilder
- Throws:
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 UrPath- See Also:
UriBuilder.path(java.lang.Class)
-
path
public ExtendedUriBuilder path(java.lang.Class resource, java.lang.String methodName) throws java.lang.IllegalArgumentException
Deprecated.Append path segments from a Path-annotated method to the existing list of segments. When constructing the final path, each segment will be separated by '/' if necessary. This method is a convenience shortcut topath(Method), it can only be used in cases where there is a single method with the specified name that is annotated with @Path.- Overrides:
pathin classAbstractUriBuilder- Parameters:
resource- the root resource class containing the method.methodName- the name of the method whose @Pathvalue will be used to obtain the path segment.- Returns:
- the updated UriBuilder
- Throws:
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 UriPath- See Also:
UriBuilder.path(java.lang.Class, java.lang.String)
-
path
public ExtendedUriBuilder path(java.lang.reflect.Method method) throws java.lang.IllegalArgumentException
Deprecated.Append the path from aPath-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.- Overrides:
pathin classAbstractUriBuilder- Parameters:
method- a method whosePathvalue will be used to obtain the path to append to the existing path- Returns:
- the updated UriBuilder
- Throws:
java.lang.IllegalArgumentException- if any element of methods is null or is not annotated with aPath- See Also:
UriBuilder.path(java.lang.reflect.Method)
-
path
public ExtendedUriBuilder path(java.lang.String pathToAppend) throws java.lang.IllegalArgumentException
Deprecated.Append path to the existing path. When constructing the final path, a '/' separator will be inserted between the existing path and the supplied path if necessary. Existing '/' characters are preserved thus a single value can represent multiple URI path segments.- Overrides:
pathin classAbstractUriBuilder- Parameters:
pathToAppend- the path to append to the current path, may contain URI template parameters- Returns:
- the updated UriBuilder
- Throws:
java.lang.IllegalArgumentException- if path is null- See Also:
UriBuilder.path(java.lang.String)
-
port
public ExtendedUriBuilder port(int port) throws java.lang.IllegalArgumentException
Deprecated.Set the URI port.- Overrides:
portin classAbstractUriBuilder- Parameters:
port- the URI port, a value of -1 will unset an explicit port.- Returns:
- the updated UriBuilder
- Throws:
java.lang.IllegalArgumentException- if port is invalid- See Also:
UriBuilder.port(int)
-
port
public ExtendedUriBuilder port(java.lang.String port) throws java.lang.IllegalArgumentException
Deprecated.Set the URI port. Only integers or a variable template is allowed- Overrides:
portin classAbstractUriBuilder- Parameters:
port- the URI port (null will unset an explicit port) or a template variable.- Returns:
- the updated UriBuilder
- Throws:
java.lang.IllegalArgumentException- if given value is invalid- See Also:
AbstractUriBuilder.port(int)
-
queryParam
public ExtendedUriBuilder queryParam(java.lang.String name, java.lang.Object... values) throws java.lang.IllegalArgumentException
Deprecated.Append a query parameter to the existing set of query parameters. If multiple values are supplied the parameter will be added once per value.- Overrides:
queryParamin classAbstractUriBuilder- Parameters:
name- the query parameter name, may contain URI template parametersvalues- the query parameter value(s), each object will be converted to aStringusing itstoString()method. Stringified values may contain URI template parameters.- Returns:
- the updated UriBuilder
- Throws:
java.lang.IllegalArgumentException- if name or value is null, or if automatic encoding is disabled and name or value contains illegal characters- See Also:
UriBuilder.queryParam(String, Object...)
-
replaceMatrix
public ExtendedUriBuilder replaceMatrix(java.lang.String matrix) throws java.lang.IllegalArgumentException
Deprecated.Set the matrix parameters of the current final segment of the current URI path. This method will overwrite any existing matrix parameters on the current final segment of the current URI path. Note that the matrix parameters are tied to a particular path segment; subsequent addition of path segments will not affect their position in the URI path.- Overrides:
replaceMatrixin classAbstractUriBuilder- Parameters:
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.- Returns:
- the updated UriBuilder
- Throws:
java.lang.IllegalArgumentException- if matrix cannot be parsed, or if automatic encoding is disabled and any matrix parameter name or value contains illegal characters- See Also:
UriBuilder.replaceMatrix(String)
-
replaceMatrixParam
public ExtendedUriBuilder replaceMatrixParam(java.lang.String name, java.lang.Object... values) throws java.lang.IllegalArgumentException
Deprecated.- Overrides:
replaceMatrixParamin classAbstractUriBuilder- Throws:
java.lang.IllegalArgumentException- See Also:
UriBuilder.replaceMatrixParam(java.lang.String, java.lang.Object[])
-
replacePath
public ExtendedUriBuilder replacePath(java.lang.String newPath)
Deprecated.Set the URI path. This method will overwrite any existing path and associated matrix parameters. Existing '/' characters are preserved thus a single value can represent multiple URI path segments.- Overrides:
replacePathin classAbstractUriBuilder- Parameters:
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.- Returns:
- the updated UriBuilder
- See Also:
UriBuilder.replacePath(java.lang.String)
-
replaceQuery
public ExtendedUriBuilder replaceQuery(java.lang.String query) throws java.lang.IllegalArgumentException
Deprecated.Set the URI query string. This method will overwrite any existing query parameters.- Overrides:
replaceQueryin classAbstractUriBuilder- Parameters:
query- the URI query string, may contain URI template parameters. A null value will remove all query parameters.- Returns:
- the updated UriBuilder
- Throws:
java.lang.IllegalArgumentException- if query cannot be parsed- See Also:
UriBuilder.replaceQuery(java.lang.String)
-
replaceQueryParam
public ExtendedUriBuilder replaceQueryParam(java.lang.String name, java.lang.Object... values) throws java.lang.IllegalArgumentException
Deprecated.- Overrides:
replaceQueryParamin classAbstractUriBuilder- Throws:
java.lang.IllegalArgumentException- See Also:
UriBuilder.replaceQueryParam(String, Object[])
-
scheme
public ExtendedUriBuilder scheme(java.lang.String scheme) throws java.lang.IllegalArgumentException
Deprecated.Set the URI scheme.- Overrides:
schemein classAbstractUriBuilder- Parameters:
scheme- the URI scheme, may contain URI template parameters- Returns:
- the updated UriBuilder
- Throws:
java.lang.IllegalArgumentException- if scheme is invalid or is null- See Also:
UriBuilder.scheme(java.lang.String)
-
schemeSpecificPart
public ExtendedUriBuilder schemeSpecificPart(java.lang.String ssp) throws java.lang.IllegalArgumentException
Deprecated.Set the URI scheme-specific-part (seeURI). This method will overwrite any existing values for authority, user-info, host, port and path.- Overrides:
schemeSpecificPartin classAbstractUriBuilder- Parameters:
ssp- the URI scheme-specific-part, may contain URI template parameters- Returns:
- the updated UriBuilder
- Throws:
java.lang.IllegalArgumentException- if ssp cannot be parsed or is null- See Also:
UriBuilder.schemeSpecificPart(java.lang.String)
-
segment
public ExtendedUriBuilder segment(java.lang.String... segments) throws java.lang.IllegalArgumentException
Deprecated.Append path segments to the existing path. When constructing the final path, a '/' separator will be inserted between the existing path and the first path segment if necessary and each supplied segment will also be separated by '/'. Existing '/' characters are encoded thus a single value can only represent a single URI path segment.- Overrides:
segmentin classAbstractUriBuilder- Parameters:
segments- the path segment values, each may contain URI template parameters- Returns:
- the updated UriBuilder
- Throws:
java.lang.IllegalArgumentException- if segments or any element of segments is null- See Also:
UriBuilder.segment(java.lang.String[])
-
toString
public java.lang.String toString()
Deprecated.Returns the actual URI as String.- Overrides:
toStringin classAbstractUriBuilder- Returns:
- the actual URI as String.
- See Also:
AbstractUriBuilder.toStringWithCheck(boolean)
-
uri
public ExtendedUriBuilder uri(java.net.URI uri) throws java.lang.IllegalArgumentException
Deprecated.Copies the non-null components of the supplied URI to the UriBuilder replacing any existing values for those components.- Overrides:
uriin classAbstractUriBuilder- Parameters:
uri- the URI to copy components from- Returns:
- the updated UriBuilder
- Throws:
java.lang.IllegalArgumentException- if uri is null- See Also:
UriBuilder.uri(java.net.URI)
-
userInfo
public ExtendedUriBuilder userInfo(java.lang.String ui)
Deprecated.Set the URI user-info.- Overrides:
userInfoin classAbstractUriBuilder- Parameters:
ui- the URI user-info, may contain URI template parameters- Returns:
- the updated UriBuilder
- See Also:
UriBuilder.userInfo(java.lang.String)
-
-