## com.sun.jersey.api.uri
Class UriBuilderImpl

    java.lang.Object
      javax.ws.rs.core.UriBuilder
          com.sun.jersey.api.uri.UriBuilderImpl

    public class UriBuilderImpl

extends UriBuilder

An implementaton of `UriBuilder`.

Author:
  Paul Sandoz, Martin Matula (martin.matula at oracle.com)

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.
`UriBuilder` | `clone()` Create a copy of the UriBuilder preserving its state.
`UriBuilder` | `fragment(java.lang.String fragment)` Set the URI fragment.
`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 methodName)` 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 path)` Append path to the existing path.
`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.
`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` | `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` | `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

### UriBuilderImpl

    public UriBuilderImpl()

Method Detail

### clone

    public UriBuilder clone()

  Description copied from class: `UriBuilder`
  Create 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 the `UriBuilder.build(java.lang.Object...)` method.

  Specified by:
    `clone` in class `UriBuilder`
  Returns:
    a copy of the UriBuilder

### uri

    public UriBuilder uri(java.net.URI uri)

  Description copied from class: `UriBuilder`
  Copies the non-null components of the supplied URI to the UriBuilder replacing any existing values for those components.

  Specified by:
    `uri` in class `UriBuilder`
  Parameters:
    `uri` - the URI to copy components from
  Returns:
    the updated UriBuilder

### scheme

    public UriBuilder scheme(java.lang.String scheme)

  Description copied from class: `UriBuilder`
  Set the URI scheme.

  Specified by:
    `scheme` in class `UriBuilder`
  Parameters:
    `scheme` - the URI scheme, may contain URI template parameters. A null value will unset the URI scheme.
  Returns:
    the updated UriBuilder

### schemeSpecificPart

    public UriBuilder schemeSpecificPart(java.lang.String ssp)

  Description copied from class: `UriBuilder`
  Set the URI scheme-specific-part (see `URI`). This method will overwrite any existing values for authority, user-info, host, port and path.

  Specified by:
    `schemeSpecificPart` in class `UriBuilder`
  Parameters:
    `ssp` - the URI scheme-specific-part, may contain URI template parameters
  Returns:
    the updated UriBuilder

### userInfo

    public UriBuilder userInfo(java.lang.String ui)

  Description copied from class: `UriBuilder`
  Set the URI user-info.

  Specified by:
    `userInfo` in class `UriBuilder`
  Parameters:
    `ui` - the URI user-info, may contain URI template parameters. A null value will unset userInfo component of the URI.
  Returns:
    the updated UriBuilder

### host

    public UriBuilder host(java.lang.String host)

  Description copied from class: `UriBuilder`
  Set the URI host.

  Specified by:
    `host` in class `UriBuilder`
  Parameters:
    `host` - the URI host, may contain URI template parameters. A null value will unset the host component of the URI.
  Returns:
    the updated UriBuilder

### port

    public UriBuilder port(int port)

  Description copied from class: `UriBuilder`
  Set the URI port.

  Specified by:
    `port` in class `UriBuilder`
  Parameters:
    `port` - the URI port, a value of -1 will unset an explicit port.
  Returns:
    the updated UriBuilder

### replacePath

    public UriBuilder replacePath(java.lang.String path)

  Description copied from class: `UriBuilder`
  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.

  Specified by:
    `replacePath` in class `UriBuilder`
  Parameters:
    `path` - the path, may contain URI template parameters. A null value will unset the path component of the URI.
  Returns:
    the updated UriBuilder

### path

    public UriBuilder path(java.lang.String path)

  Description copied from class: `UriBuilder`
  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.

  Specified by:
    `path` in class `UriBuilder`
  Parameters:
    `path` - the path, may contain URI template parameters
  Returns:
    the updated UriBuilder

### path

    public UriBuilder path(java.lang.Class resource)

  Description copied from class: `UriBuilder`
  Append 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:
    `path` in class `UriBuilder`
  Parameters:
    `resource` - a resource whose `Path` value will be used to obtain the path to append.
  Returns:
    the updated UriBuilder

### path

    public UriBuilder path(java.lang.Class resource,
                           java.lang.String methodName)

  Description copied from class: `UriBuilder`
  Append 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 to `path(Method)`, it can only be used in cases where there is a single method with the specified name that is annotated with `Path`.

  Specified by:
    `path` in class `UriBuilder`
  Parameters:
    `resource` - the resource containing the method
    `methodName` - the name of the method whose `Path` value will be used to obtain the path to append
  Returns:
    the updated UriBuilder

### path

    public UriBuilder path(java.lang.reflect.Method method)

  Description copied from class: `UriBuilder`
  Append 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.

  Specified by:
    `path` in class `UriBuilder`
  Parameters:
    `method` - a method whose `Path` value will be used to obtain the path to append to the existing path
  Returns:
    the updated UriBuilder

### segment

    public UriBuilder segment(java.lang.String... segments)
                       throws java.lang.IllegalArgumentException

  Description copied from class: `UriBuilder`
  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.

  Specified by:
    `segment` in class `UriBuilder`
  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

### replaceMatrix

    public UriBuilder replaceMatrix(java.lang.String matrix)

  Description copied from class: `UriBuilder`
  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.

  Specified by:
    `replaceMatrix` in class `UriBuilder`
  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
  See Also:
    Matrix URIs

### matrixParam

    public UriBuilder matrixParam(java.lang.String name,
                                  java.lang.Object... values)

  Description copied from class: `UriBuilder`
  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.

  Specified by:
    `matrixParam` in class `UriBuilder`
  Parameters:
    `name` - the matrix parameter name, may contain URI template parameters
    `values` - the matrix parameter value(s), each object will be converted to a `String` using its `toString()` method. Stringified values may contain URI template parameters.
  Returns:
    the updated UriBuilder
  See Also:
    Matrix URIs

### replaceMatrixParam

    public UriBuilder replaceMatrixParam(java.lang.String name,
                                         java.lang.Object... values)

  Description copied from class: `UriBuilder`
  Replace 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:
    `replaceMatrixParam` in class `UriBuilder`
  Parameters:
    `name` - the matrix parameter name, may contain URI template parameters
    `values` - 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.
  Returns:
    the updated UriBuilder
  See Also:
    Matrix URIs

### replaceQuery

    public UriBuilder replaceQuery(java.lang.String query)

  Description copied from class: `UriBuilder`
  Set the URI query string. This method will overwrite any existing query parameters.

  Specified by:
    `replaceQuery` in class `UriBuilder`
  Parameters:
    `query` - the URI query string, may contain URI template parameters. A null value will remove all query parameters.
  Returns:
    the updated UriBuilder

### queryParam

    public UriBuilder queryParam(java.lang.String name,
                                 java.lang.Object... values)

  Description copied from class: `UriBuilder`
  Append 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:
    `queryParam` in class `UriBuilder`
  Parameters:
    `name` - the query parameter name, may contain URI template parameters
    `values` - the query parameter value(s), each object will be converted to a `String` using its `toString()` method. Stringified values may contain URI template parameters.
  Returns:
    the updated UriBuilder

### replaceQueryParam

    public UriBuilder replaceQueryParam(java.lang.String name,
                                        java.lang.Object... values)

  Description copied from class: `UriBuilder`
  Replace the existing value(s) of a query parameter. If multiple values are supplied the parameter will be added once per value.

  Specified by:
    `replaceQueryParam` in class `UriBuilder`
  Parameters:
    `name` - the query parameter name, may contain URI template parameters
    `values` - 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.
  Returns:
    the updated UriBuilder

### fragment

    public UriBuilder fragment(java.lang.String fragment)

  Description copied from class: `UriBuilder`
  Set the URI fragment.

  Specified by:
    `fragment` in class `UriBuilder`
  Parameters:
    `fragment` - the URI fragment, may contain URI template parameters. A null value will remove any existing fragment.
  Returns:
    the updated UriBuilder

### buildFromMap

    public java.net.URI buildFromMap(java.util.Map<java.lang.String,? extends java.lang.Object> values)

  Description copied from class: `UriBuilder`
  Build a URI, any URI template parameters will be replaced by the value in the supplied map. Values are converted to `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.

  Specified by:
    `buildFromMap` in class `UriBuilder`
  Parameters:
    `values` - a map of URI template parameter names and values
  Returns:
    the URI built from the UriBuilder

### buildFromEncodedMap

    public java.net.URI buildFromEncodedMap(java.util.Map<java.lang.String,? extends java.lang.Object> values)
                                     throws java.lang.IllegalArgumentException,
                                            UriBuilderException

  Description copied from class: `UriBuilder`
  Build a URI, any URI template parameters will be replaced by the value in the supplied map. Values are converted to `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 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:
    `buildFromEncodedMap` in class `UriBuilder`
  Parameters:
    `values` - a map of URI template parameter names and 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 template parameter value is null.
    `UriBuilderException` - if a URI cannot be constructed based on the current state of the builder.

### build

    public java.net.URI build(java.lang.Object... values)

  Description copied from class: `UriBuilder`
  Build a URI, using the supplied values in order to replace any URI template parameters. Values are converted to `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".

  Specified by:
    `build` in class `UriBuilder`
  Parameters:
    `values` - a list of URI template parameter values
  Returns:
    the URI built from the UriBuilder

### buildFromEncoded

    public java.net.URI buildFromEncoded(java.lang.Object... values)

  Description copied from class: `UriBuilder`
  Build a URI. Any URI templates parameters will be replaced with the supplied values in order. Values are converted to `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 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:
    `buildFromEncoded` in class `UriBuilder`
  Parameters:
    `values` - a list of URI template parameter values
  Returns:
    the URI built from the UriBuilder

Copyright © 2017 Oracle Corporation. All Rights Reserved.