Class ResteasyUriBuilderImpl
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Field Summary
Fields inherited from class org.jboss.resteasy.spi.ResteasyUriBuilder
hierarchicalUri, opaqueUri -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBuild a URI, using the supplied values in order to replace any URI template parameters.Build a URI, using the supplied values in order to replace any URI template parameters.buildFromEncoded(Object... values) Build a URI.buildFromEncodedMap(Map<String, ? extends Object> values) Build a URI.buildFromMap(Map<String, ?> values, boolean encodeSlashInPath) Build a URI.buildFromMap(Map<String, ? extends Object> values) Build a URI.protected URIbuildFromValues(boolean encodeSlash, boolean encoded, Object... values) protected URIbuildUriFromMap(Map<String, ? extends Object> paramMap, boolean fromEncodedMap, boolean encodeSlash) clientQueryParam(String name, Object... values) Called by ClientRequest.getUri() to add a query parameter for@QueryParamparameters.clone()Create a copy of the UriBuilder preserving its state.static MatchercreateUriParamMatcher(String string) Set the URI fragment.getHost()getPath()Return a unique order list of path params.intgetPort()getQuery()getSsp()Set the URI host.matrixParam(String name, Object... values) Append a matrix parameter to the existing set of matrix parameters of the current final segment of the URI path.protected UriBuilderparseHierarchicalUri(CharSequence uriTemplate, Matcher match) Append the path from a Path-annotated class to the existing path.Append the path from a Path-annotated method to the existing path.Append the path from aPath-annotated method to the existing path.Append path to the existing path.protected static Stringport(int port) Set the URI port.queryParam(String name, Object... values) Append a query parameter to the existing set of query parameters.replaceMatrix(String matrix) Set the matrix parameters of the current final segment of the current URI path.replaceMatrixParam(String name, Object... values) Replace the existing value(s) of a matrix parameter on the current final segment of the URI path.protected StringBuilderreplaceParameter(Map<String, ? extends Object> paramMap, boolean fromEncodedMap, boolean isTemplate, String string, StringBuilder builder, boolean encodeSlash) replacePath(String path) Set the URI path.protected StringBuilderreplacePathParameter(String name, String value, boolean isEncoded, String string, StringBuilder builder, boolean encodeSlash) replaceQuery(String query) Set the URI query string.replaceQueryNoEncoding(String query) replaceQueryParam(String name, Object... values) Replace the existing value(s) of a query parameter.protected StringBuilderreplaceQueryStringParameter(Map<String, ? extends Object> paramMap, boolean fromEncodedMap, boolean isTemplate, String string, StringBuilder builder) resolveTemplate(String name, Object value) Resolve a URI template with a givennamein thisUriBuilderinstance using a supplied value.resolveTemplate(String name, Object value, boolean encodeSlashInPath) Resolve a URI template with a givennamein thisUriBuilderinstance using a supplied value.resolveTemplateFromEncoded(String name, Object value) Resolve a URI template with a givennamein thisUriBuilderinstance using a supplied encoded value.resolveTemplates(Map<String, Object> templateValues) Resolve one or more URI templates in thisUriBuilderinstance using supplied name-value pairs.resolveTemplates(Map<String, Object> templateValues, boolean encodeSlashInPath) Resolve one or more URI templates in thisUriBuilderinstance using supplied name-value pairs.resolveTemplatesFromEncoded(Map<String, Object> templateValues) Resolve one or more URI templates in thisUriBuilderinstance using supplied name-value pairs.Set the URI scheme.schemeSpecificPart(String ssp) Set the URI scheme-specific-part (seeURI).Append path segments to the existing path.substitutePathParam(String name, Object value, boolean isEncoded) Only replace path params in path of URI.Get the URI template string represented by this URI builder.Parses theuriTemplatestring and copies the parsed components of the supplied URI to the UriBuilder replacing any existing values for those components.Copies the non-null components of the supplied URI to the UriBuilder replacing any existing values for those components.uriFromCharSequence(CharSequence uriTemplate) uriTemplate(CharSequence uriTemplate) You may put path parameters anywhere within the uriTemplate except port.Set the URI user-info.Methods inherited from class org.jboss.resteasy.spi.ResteasyUriBuilder
compare, fromTemplate, relativizeMethods inherited from class jakarta.ws.rs.core.UriBuilder
fromLink, fromMethod, fromPath, fromResource, fromUri, fromUri, newInstance
-
Constructor Details
-
ResteasyUriBuilderImpl
public ResteasyUriBuilderImpl() -
ResteasyUriBuilderImpl
-
-
Method Details
-
clone
Description copied from class:UriBuilderCreate a copy of the UriBuilder preserving its state. This is a more efficient means of creating a copy than constructing a new UriBuilder from a URI returned by theUriBuilder.build(Object...)method.- Specified by:
clonein classResteasyUriBuilder- Returns:
- a copy of the UriBuilder.
-
uriTemplate
You may put path parameters anywhere within the uriTemplate except port.- Specified by:
uriTemplatein classResteasyUriBuilder- Parameters:
uriTemplate- uri template- Returns:
- uri builder
-
parseHierarchicalUri
-
uri
Description copied from class:UriBuilderParses theuriTemplatestring and copies the parsed components of the supplied URI to the UriBuilder replacing any existing values for those components.- Specified by:
uriin classUriBuilder- Parameters:
uriTemplate- a URI template that will be used to initialize the UriBuilder, may contain URI parameters.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- ifuriTemplateis not a valid URI template or isnull.
-
uriFromCharSequence
- Specified by:
uriFromCharSequencein classResteasyUriBuilder- Throws:
IllegalArgumentException
-
uri
Description copied from class:UriBuilderCopies the non-null components of the supplied URI to the UriBuilder replacing any existing values for those components.- Specified by:
uriin classUriBuilder- Parameters:
uri- the URI to copy components from.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if theuriparameter isnull.
-
scheme
Description copied from class:UriBuilderSet the URI scheme.- Specified by:
schemein classUriBuilder- Parameters:
scheme- the URI scheme, may contain URI template parameters. Anullvalue will unset the URI scheme, but will not unset the any scheme-specific-part components.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if scheme is invalid.
-
schemeSpecificPart
Description copied from class:UriBuilderSet the URI scheme-specific-part (seeURI). This method will overwrite any existing values for authority, user-info, host, port and path.- Specified by:
schemeSpecificPartin classUriBuilder- Parameters:
ssp- the URI scheme-specific-part, may contain URI template parameters.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if ssp cannot be parsed or isnull.
-
userInfo
Description copied from class:UriBuilderSet the URI user-info.- Specified by:
userInfoin classUriBuilder- Parameters:
ui- the URI user-info, may contain URI template parameters. Anullvalue will unset userInfo component of the URI.- Returns:
- the updated UriBuilder.
-
host
Description copied from class:UriBuilderSet the URI host.- Specified by:
hostin classUriBuilder- Parameters:
host- the URI host, may contain URI template parameters. Anullvalue will unset the host component of the URI, but will not unset other authority component parts (user infoorport).- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if host is invalid.
-
port
Description copied from class:UriBuilderSet the URI port.- Specified by:
portin classUriBuilder- Parameters:
port- the URI port, a value of -1 will unset an explicit port.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if port is invalid.
-
paths
-
path
Description copied from class:UriBuilderAppend 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.- Specified by:
pathin classUriBuilder- Parameters:
segment- the path, may contain URI template parameters.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if path isnull.
-
path
Description copied from class:UriBuilderAppend the path from a Path-annotated class to the existing path. When constructing the final path, a '/' separator will be inserted between the existing path and the supplied path if necessary.- Specified by:
pathin classUriBuilder- Parameters:
resource- a resource whosePathvalue will be used to obtain the path to append.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if resource isnull, or if resource is not annotated withPath.
-
path
Description copied from class:UriBuilderAppend the path from a 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. 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 withPath.- Specified by:
pathin classUriBuilder- Parameters:
resource- the resource containing the method.method- the name of the method whosePathvalue will be used to obtain the path to append.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if resource or method isnull, or there is more than or less than one variant of the method annotated withPath.
-
path
Description copied from class:UriBuilderAppend 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.- Specified by:
pathin classUriBuilder- Parameters:
method- a method whosePathvalue will be used to obtain the path to append to the existing path.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if method isnullor is not annotated with aPath.
-
replaceMatrix
Description copied from class:UriBuilderSet 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.- Specified by:
replaceMatrixin classUriBuilder- Parameters:
matrix- the matrix parameters, may contain URI template parameters. Anullvalue will remove all matrix parameters of the current final segment of the current URI path.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if matrix cannot be parsed.- See Also:
-
replaceQuery
Description copied from class:UriBuilderSet the URI query string. This method will overwrite any existing query parameters.- Specified by:
replaceQueryin classUriBuilder- Parameters:
query- the URI query string, may contain URI template parameters. Anullvalue will remove all query parameters.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if query cannot be parsed.
-
replaceQueryNoEncoding
-
fragment
Description copied from class:UriBuilderSet the URI fragment.- Specified by:
fragmentin classUriBuilder- Parameters:
fragment- the URI fragment, may contain URI template parameters. Anullvalue will remove any existing fragment.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException
-
substitutePathParam
Only replace path params in path of URI. This changes state of URIBuilder.- Specified by:
substitutePathParamin classResteasyUriBuilder- Parameters:
name- parameter namevalue- parameter valueisEncoded- encoded flag- Returns:
- uri builder
-
buildFromMap
public URI buildFromMap(Map<String, ? extends Object> values) throws IllegalArgumentException, UriBuilderExceptionDescription copied from class:UriBuilderBuild a URI. Any URI template parameters will be replaced by the value in the supplied map. Values are converted toStringusing theirtoString()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.NOTE: By default all
'/'characters in the stringified values will be encoded in path templates, i.e. the result is identical to invokingbuildFromMap(valueMap, true). To override this behavior usebuildFromMap(valueMap, false)instead.- Specified by:
buildFromMapin classUriBuilder- Parameters:
values- a map of URI template parameter names and values.- Returns:
- the URI built from the UriBuilder.
- Throws:
IllegalArgumentException- if there are any URI template parameters without a supplied value, or if a template parameter value isnull.UriBuilderException- if a URI cannot be constructed based on the current state of the builder.- See Also:
-
buildFromEncodedMap
public URI buildFromEncodedMap(Map<String, ? extends Object> values) throws IllegalArgumentException, UriBuilderExceptionDescription copied from class:UriBuilderBuild a URI. Any URI template parameters will be replaced by the value in the supplied map. Values are converted toStringusing theirtoString()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.- Specified by:
buildFromEncodedMapin classUriBuilder- Parameters:
values- a map of URI template parameter names and values.- Returns:
- the URI built from the UriBuilder.
- Throws:
IllegalArgumentException- if there are any URI template parameters without a supplied value, or if a template parameter value isnull.UriBuilderException- if a URI cannot be constructed based on the current state of the builder.- See Also:
-
buildFromMap
public URI buildFromMap(Map<String, ?> values, boolean encodeSlashInPath) throws IllegalArgumentException, UriBuilderExceptionDescription copied from class:UriBuilderBuild a URI. Any URI template parameters will be replaced by the value in the supplied map. Values are converted toStringusing theirtoString()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.The
encodeSlashInPathparameter may be used to override the default encoding of'/'characters in the stringified template values in cases when the template is part of the URI path component when using theUriBuilder.buildFromMap(java.util.Map)method. If theencodeSlashInPathparameter is set totrue(default), the slash ('/') characters in parameter values will be encoded if the template is placed in the URI path component. If set tofalsethe default encoding behavior is overridden an slash characters in template values will not be encoded when used to substitute path templates.- Specified by:
buildFromMapin classUriBuilder- Parameters:
values- a map of URI template parameter names and values.encodeSlashInPath- iftrue, the slash ('/') characters in parameter values will be encoded if the template is placed in the URI path component, otherwise the slash characters will not be encoded in path templates.- Returns:
- the URI built from the UriBuilder.
- Throws:
IllegalArgumentException- if there are any URI template parameters without a supplied value, or if a template parameter value isnull.UriBuilderException- if a URI cannot be constructed based on the current state of the builder.- See Also:
-
buildUriFromMap
protected URI buildUriFromMap(Map<String, ? extends Object> paramMap, boolean fromEncodedMap, boolean encodeSlash) throws IllegalArgumentException, UriBuilderException -
replacePathParameter
protected StringBuilder replacePathParameter(String name, String value, boolean isEncoded, String string, StringBuilder builder, boolean encodeSlash) -
createUriParamMatcher
-
replaceParameter
protected StringBuilder replaceParameter(Map<String, ? extends Object> paramMap, boolean fromEncodedMap, boolean isTemplate, String string, StringBuilder builder, boolean encodeSlash) -
replaceQueryStringParameter
protected StringBuilder replaceQueryStringParameter(Map<String, ? extends Object> paramMap, boolean fromEncodedMap, boolean isTemplate, String string, StringBuilder builder) -
getPathParamNamesInDeclarationOrder
Return a unique order list of path params.- Specified by:
getPathParamNamesInDeclarationOrderin classResteasyUriBuilder- Returns:
- list of path parameters
-
build
Description copied from class:UriBuilderBuild a URI, using the supplied values in order to replace any URI template parameters. Values are converted toStringusing theirtoString()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".
NOTE: By default all
'/'characters in the stringified values will be encoded in path templates, i.e. the result is identical to invokingUriBuilder.build(Object[], boolean)build(values, true)}. To override this behavior usebuild(values, false)instead.- Specified by:
buildin classUriBuilder- Parameters:
values- a list of URI template parameter values.- Returns:
- the URI built from the UriBuilder.
- Throws:
IllegalArgumentException- if there are any URI template parameters without a supplied value, or if a value isnull.UriBuilderException- if a URI cannot be constructed based on the current state of the builder.- See Also:
-
buildFromValues
-
matrixParam
Description copied from class:UriBuilderAppend 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.- Specified by:
matrixParamin classUriBuilder- Parameters:
name- the matrix parameter name, may contain URI template parameters.values- 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:
IllegalArgumentException- if name or values isnull.- See Also:
-
replaceMatrixParam
Description copied from class:UriBuilderReplace the existing value(s) of a matrix parameter on 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.- Specified by:
replaceMatrixParamin classUriBuilder- Parameters:
name- the matrix parameter name, may contain URI template parameters.values- the matrix parameter value(s), each object will be converted. to aStringusing itstoString()method. Stringified values may contain URI template parameters. Ifvaluesis empty ornullthen all current values of the parameter are removed.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if name isnull.- See Also:
-
clientQueryParam
Called by ClientRequest.getUri() to add a query parameter for@QueryParamparameters. We do not use UriBuilder.queryParam() because- queryParam() supports URI template processing and this method must
always encode braces (for parameter substitution is not possible for
@QueryParamparameters). - queryParam() supports "contextual URI encoding" (i.e., it does not
encode
%characters that are followed by two hex characters). The JavaDoc for@QueryParam.value()explicitly states that the value is specified in decoded format and that "any percent encoded literals within the value will not be decoded and will instead be treated as literal text". This means that it is an explicit bug to perform contextual URI encoding of this method's name parameter; hence, we must always encode said parameter. This method also foregoes contextual URI encoding on this method's values parameter because it represents arbitrary data passed to aQueryParamparameter of a client proxy (since the client proxy is nothing more than a transport layer, it should not be "interpreting" such data; instead, it should faithfully transmit this data over the wire).
- Specified by:
clientQueryParamin classResteasyUriBuilder- Parameters:
name- the name of the query parameter.values- the value(s) of the query parameter.- Returns:
- Returns this instance to allow call chaining.
- Throws:
IllegalArgumentException
- queryParam() supports URI template processing and this method must
always encode braces (for parameter substitution is not possible for
-
queryParam
Description copied from class:UriBuilderAppend a query parameter to the existing set of query parameters. If multiple values are supplied the parameter will be added once per value.- Specified by:
queryParamin classUriBuilder- Parameters:
name- the query parameter name, may contain URI template parameters.values- 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:
IllegalArgumentException- if name or values isnull.
-
replaceQueryParam
Description copied from class:UriBuilderReplace the existing value(s) of a query parameter. If multiple values are supplied the parameter will be added once per value.- Specified by:
replaceQueryParamin classUriBuilder- Parameters:
name- the query parameter name, may contain URI template parameters.values- the query parameter value(s), each object will be converted to aStringusing itstoString()method. Stringified values may contain URI template parameters. Ifvaluesis empty ornullthen all current values of the parameter are removed.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if name isnull.
-
getHost
- Specified by:
getHostin classResteasyUriBuilder
-
getScheme
- Specified by:
getSchemein classResteasyUriBuilder
-
getPort
public int getPort()- Specified by:
getPortin classResteasyUriBuilder
-
getUserInfo
- Specified by:
getUserInfoin classResteasyUriBuilder
-
getPath
- Specified by:
getPathin classResteasyUriBuilder
-
getQuery
- Specified by:
getQueryin classResteasyUriBuilder
-
getFragment
- Specified by:
getFragmentin classResteasyUriBuilder
-
getAuthority
-
getSsp
-
segment
Description copied from class:UriBuilderAppend 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.- Specified by:
segmentin classUriBuilder- Parameters:
segments- the path segment values, each may contain URI template parameters.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if segments or any element of segments isnull.
-
buildFromEncoded
Description copied from class:UriBuilderBuild a URI. Any URI templates parameters will be replaced with the supplied values in order. Values are converted toStringusing theirtoString()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".
- Specified by:
buildFromEncodedin classUriBuilder- Parameters:
values- a list of URI template parameter values.- Returns:
- the URI built from the UriBuilder.
- Throws:
IllegalArgumentException- if there are any URI template parameters without a supplied value, or if a value isnull.UriBuilderException- if a URI cannot be constructed based on the current state of the builder.- See Also:
-
replacePath
Description copied from class:UriBuilderSet 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.- Specified by:
replacePathin classUriBuilder- Parameters:
path- the path, may contain URI template parameters. Anullvalue will unset the path component of the URI.- Returns:
- the updated UriBuilder.
-
build
public URI build(Object[] values, boolean encodeSlashInPath) throws IllegalArgumentException, UriBuilderException Description copied from class:UriBuilderBuild a URI, using the supplied values in order to replace any URI template parameters. Values are converted toStringusing theirtoString()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".
The
encodeSlashInPathparameter may be used to override the default encoding of'/'characters in the stringified template values in cases when the template is part of the URI path component when using theUriBuilder.build(Object[])method. If theencodeSlashInPathparameter is set totrue(default), the slash ('/') characters in parameter values will be encoded if the template is placed in the URI path component. If set tofalsethe default encoding behavior is overridden an slash characters in template values will not be encoded when used to substitute path templates.- Specified by:
buildin classUriBuilder- Parameters:
values- a list of URI template parameter values.encodeSlashInPath- iftrue, the slash ('/') characters in parameter values will be encoded if the template is placed in the URI path component, otherwise the slash characters will not be encoded in path templates.- Returns:
- the URI built from the UriBuilder.
- Throws:
IllegalArgumentException- if there are any URI template parameters without a supplied value, or if a value isnull.UriBuilderException- if a URI cannot be constructed based on the current state of the builder.- See Also:
-
toTemplate
Description copied from class:UriBuilderGet the URI template string represented by this URI builder.- Specified by:
toTemplatein classUriBuilder- Returns:
- the URI template string for this URI builder.
-
resolveTemplate
Description copied from class:UriBuilderResolve a URI template with a givennamein thisUriBuilderinstance using a supplied value. In case anulltemplate name or value is entered aIllegalArgumentExceptionis thrown.- Specified by:
resolveTemplatein classUriBuilder- Parameters:
name- name of the URI template.value- value to be used to resolve the template.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if the resolved template name or value isnull.
-
resolveTemplates
public UriBuilder resolveTemplates(Map<String, Object> templateValues) throws IllegalArgumentExceptionDescription copied from class:UriBuilderResolve one or more URI templates in thisUriBuilderinstance using supplied name-value pairs. A call to the method with an empty parameter map is ignored.- Specified by:
resolveTemplatesin classUriBuilder- Parameters:
templateValues- a map of URI template names and their values.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if the name-value map or any of the names or values in the map isnull.
-
resolveTemplate
public UriBuilder resolveTemplate(String name, Object value, boolean encodeSlashInPath) throws IllegalArgumentException Description copied from class:UriBuilderResolve a URI template with a givennamein thisUriBuilderinstance using a supplied value. In case anulltemplate name or value is entered aIllegalArgumentExceptionis thrown.- Specified by:
resolveTemplatein classUriBuilder- Parameters:
name- name of the URI template.value- value to be used to resolve the template.encodeSlashInPath- iftrue, the slash ('/') characters in template values will be encoded if the template is placed in the URI path component, otherwise the slash characters will not be encoded in path templates.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if the resolved template name or value isnull.
-
resolveTemplateFromEncoded
public UriBuilder resolveTemplateFromEncoded(String name, Object value) throws IllegalArgumentException Description copied from class:UriBuilderResolve a URI template with a givennamein thisUriBuilderinstance using a supplied encoded value. A template with a matching name will be replaced by the supplied value. Value is converted toStringusing itstoString()method and is 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. In case anulltemplate name or encoded value is entered aIllegalArgumentExceptionis thrown.- Specified by:
resolveTemplateFromEncodedin classUriBuilder- Parameters:
name- name of the URI template.value- encoded value to be used to resolve the template.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if the resolved template name or encoded value isnull.
-
resolveTemplates
public UriBuilder resolveTemplates(Map<String, Object> templateValues, boolean encodeSlashInPath) throws IllegalArgumentExceptionDescription copied from class:UriBuilderResolve one or more URI templates in thisUriBuilderinstance using supplied name-value pairs. A call to the method with an empty parameter map is ignored.- Specified by:
resolveTemplatesin classUriBuilder- Parameters:
templateValues- a map of URI template names and their values.encodeSlashInPath- iftrue, the slash ('/') characters in template values will be encoded if the template is placed in the URI path component, otherwise the slash characters will not be encoded in path templates.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if the name-value map or any of the names or values in the map isnull.
-
resolveTemplatesFromEncoded
public UriBuilder resolveTemplatesFromEncoded(Map<String, Object> templateValues) throws IllegalArgumentExceptionDescription copied from class:UriBuilderResolve one or more URI templates in thisUriBuilderinstance using supplied name-value pairs. All templates with their name matching one of the keys in the supplied map will be replaced by the value in the supplied map. Values are converted toStringusing theirtoString()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. A call to the method with an empty parameter map is ignored.- Specified by:
resolveTemplatesFromEncodedin classUriBuilder- Parameters:
templateValues- a map of URI template names and their values.- Returns:
- the updated UriBuilder.
- Throws:
IllegalArgumentException- if the name-value map or any of the names or values in the map isnull.
-