Package org.jboss.resteasy.specimpl

## Class ResteasyUriBuilderImpl

- java.lang.Object
- - javax.ws.rs.core.UriBuilder
  - - org.jboss.resteasy.spi.ResteasyUriBuilder
    - - org.jboss.resteasy.specimpl.ResteasyUriBuilderImpl

-     public class ResteasyUriBuilderImpl
      extends ResteasyUriBuilder

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    - ### Fields inherited from class org.jboss.resteasy.spi.ResteasyUriBuilder

      `hierarchicalUri, opaqueUri`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ResteasyUriBuilderImpl()` |
    `ResteasyUriBuilderImpl​(String host, String scheme, int port, String userInfo, String path, String query, String fragment, String ssp, String authority)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `URI` | `build​(Object... values)` |
    `URI` | `build​(Object[] values, boolean encodeSlashInPath)` |
    `URI` | `buildFromEncoded​(Object... values)` |
    `URI` | `buildFromEncodedMap​(Map<String,​? extends Object> values)` |
    `URI` | `buildFromMap​(Map<String,​?> values, boolean encodeSlashInPath)` |
    `URI` | `buildFromMap​(Map<String,​? extends Object> values)` |
    `protected URI` | `buildFromValues​(boolean encodeSlash, boolean encoded, Object... values)` |
    `protected URI` | `buildUriFromMap​(Map<String,​? extends Object> paramMap, boolean fromEncodedMap, boolean encodeSlash)` |
    `javax.ws.rs.core.UriBuilder` | `clientQueryParam​(String name, Object... values)` | Called by ClientRequest.getUri() to add a query parameter for `@QueryParam` parameters.
    `javax.ws.rs.core.UriBuilder` | `clone()` |
    `static Matcher` | `createUriParamMatcher​(String string)` |
    `javax.ws.rs.core.UriBuilder` | `fragment​(String fragment)` |
    `String` | `getAuthority()` |
    `String` | `getFragment()` |
    `String` | `getHost()` |
    `String` | `getPath()` |
    `List<String>` | `getPathParamNamesInDeclarationOrder()` | Return a unique order list of path params.
    `int` | `getPort()` |
    `String` | `getQuery()` |
    `String` | `getScheme()` |
    `String` | `getSsp()` |
    `String` | `getUserInfo()` |
    `javax.ws.rs.core.UriBuilder` | `host​(String host)` |
    `javax.ws.rs.core.UriBuilder` | `matrixParam​(String name, Object... values)` |
    `protected javax.ws.rs.core.UriBuilder` | `parseHierarchicalUri​(CharSequence uriTemplate, Matcher match)` |
    `javax.ws.rs.core.UriBuilder` | `path​(Class resource)` |
    `javax.ws.rs.core.UriBuilder` | `path​(Class resource, String method)` |
    `javax.ws.rs.core.UriBuilder` | `path​(Method method)` |
    `javax.ws.rs.core.UriBuilder` | `path​(String segment)` |
    `protected static String` | `paths​(boolean encode, String basePath, String... segments)` |
    `javax.ws.rs.core.UriBuilder` | `port​(int port)` |
    `javax.ws.rs.core.UriBuilder` | `queryParam​(String name, Object... values)` |
    `javax.ws.rs.core.UriBuilder` | `replaceMatrix​(String matrix)` |
    `javax.ws.rs.core.UriBuilder` | `replaceMatrixParam​(String name, Object... values)` |
    `protected StringBuilder` | `replaceParameter​(Map<String,​? extends Object> paramMap, boolean fromEncodedMap, boolean isTemplate, String string, StringBuilder builder, boolean encodeSlash)` |
    `javax.ws.rs.core.UriBuilder` | `replacePath​(String path)` |
    `protected StringBuilder` | `replacePathParameter​(String name, String value, boolean isEncoded, String string, StringBuilder builder, boolean encodeSlash)` |
    `javax.ws.rs.core.UriBuilder` | `replaceQuery​(String query)` |
    `javax.ws.rs.core.UriBuilder` | `replaceQueryNoEncoding​(String query)` |
    `javax.ws.rs.core.UriBuilder` | `replaceQueryParam​(String name, Object... values)` |
    `protected StringBuilder` | `replaceQueryStringParameter​(Map<String,​? extends Object> paramMap, boolean fromEncodedMap, boolean isTemplate, String string, StringBuilder builder)` |
    `javax.ws.rs.core.UriBuilder` | `resolveTemplate​(String name, Object value)` |
    `javax.ws.rs.core.UriBuilder` | `resolveTemplate​(String name, Object value, boolean encodeSlashInPath)` |
    `javax.ws.rs.core.UriBuilder` | `resolveTemplateFromEncoded​(String name, Object value)` |
    `javax.ws.rs.core.UriBuilder` | `resolveTemplates​(Map<String,​Object> templateValues)` |
    `javax.ws.rs.core.UriBuilder` | `resolveTemplates​(Map<String,​Object> templateValues, boolean encodeSlashInPath)` |
    `javax.ws.rs.core.UriBuilder` | `resolveTemplatesFromEncoded​(Map<String,​Object> templateValues)` |
    `javax.ws.rs.core.UriBuilder` | `scheme​(String scheme)` |
    `javax.ws.rs.core.UriBuilder` | `schemeSpecificPart​(String ssp)` |
    `javax.ws.rs.core.UriBuilder` | `segment​(String... segments)` |
    `javax.ws.rs.core.UriBuilder` | `substitutePathParam​(String name, Object value, boolean isEncoded)` | Only replace path params in path of URI.
    `String` | `toTemplate()` |
    `javax.ws.rs.core.UriBuilder` | `uri​(String uriTemplate)` |
    `javax.ws.rs.core.UriBuilder` | `uri​(URI uri)` |
    `javax.ws.rs.core.UriBuilder` | `uriFromCharSequence​(CharSequence uriTemplate)` |
    `javax.ws.rs.core.UriBuilder` | `uriTemplate​(CharSequence uriTemplate)` | You may put path parameters anywhere within the uriTemplate except port.
    `javax.ws.rs.core.UriBuilder` | `userInfo​(String ui)` |

    - ### Methods inherited from class org.jboss.resteasy.spi.ResteasyUriBuilder

      `compare, fromTemplate, relativize`

    - ### Methods inherited from class javax.ws.rs.core.UriBuilder

      `fromLink, fromMethod, fromPath, fromResource, fromUri, fromUri, newInstance`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ResteasyUriBuilderImpl

          public ResteasyUriBuilderImpl()

    - #### ResteasyUriBuilderImpl

          public ResteasyUriBuilderImpl​(String host,
                                        String scheme,
                                        int port,
                                        String userInfo,
                                        String path,
                                        String query,
                                        String fragment,
                                        String ssp,
                                        String authority)

  - ### Method Detail

    - #### clone

          public javax.ws.rs.core.UriBuilder clone()

      Specified by:
        `clone` in class `ResteasyUriBuilder`

    - #### uriTemplate

          public javax.ws.rs.core.UriBuilder uriTemplate​(CharSequence uriTemplate)

      You may put path parameters anywhere within the uriTemplate except port.
      Specified by:
        `uriTemplate` in class `ResteasyUriBuilder`
      Parameters:
        `uriTemplate` - uri template
      Returns:
        uri builder

    - #### parseHierarchicalUri

          protected javax.ws.rs.core.UriBuilder parseHierarchicalUri​(CharSequence uriTemplate,
                                                                     Matcher match)

    - #### uri

          public javax.ws.rs.core.UriBuilder uri​(String uriTemplate)
                                          throws IllegalArgumentException

      Specified by:
        `uri` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### uriFromCharSequence

          public javax.ws.rs.core.UriBuilder uriFromCharSequence​(CharSequence uriTemplate)
                                                          throws IllegalArgumentException

      Specified by:
        `uriFromCharSequence` in class `ResteasyUriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### uri

          public javax.ws.rs.core.UriBuilder uri​(URI uri)
                                          throws IllegalArgumentException

      Specified by:
        `uri` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### scheme

          public javax.ws.rs.core.UriBuilder scheme​(String scheme)
                                             throws IllegalArgumentException

      Specified by:
        `scheme` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### schemeSpecificPart

          public javax.ws.rs.core.UriBuilder schemeSpecificPart​(String ssp)
                                                         throws IllegalArgumentException

      Specified by:
        `schemeSpecificPart` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### userInfo

          public javax.ws.rs.core.UriBuilder userInfo​(String ui)

      Specified by:
        `userInfo` in class `javax.ws.rs.core.UriBuilder`

    - #### host

          public javax.ws.rs.core.UriBuilder host​(String host)
                                           throws IllegalArgumentException

      Specified by:
        `host` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### port

          public javax.ws.rs.core.UriBuilder port​(int port)
                                           throws IllegalArgumentException

      Specified by:
        `port` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### paths

          protected static String paths​(boolean encode,
                                        String basePath,
                                        String... segments)

    - #### path

          public javax.ws.rs.core.UriBuilder path​(String segment)
                                           throws IllegalArgumentException

      Specified by:
        `path` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### path

          public javax.ws.rs.core.UriBuilder path​(Class resource)
                                           throws IllegalArgumentException

      Specified by:
        `path` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### path

          public javax.ws.rs.core.UriBuilder path​(Class resource,
                                                  String method)
                                           throws IllegalArgumentException

      Specified by:
        `path` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### path

          public javax.ws.rs.core.UriBuilder path​(Method method)
                                           throws IllegalArgumentException

      Specified by:
        `path` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### replaceMatrix

          public javax.ws.rs.core.UriBuilder replaceMatrix​(String matrix)
                                                    throws IllegalArgumentException

      Specified by:
        `replaceMatrix` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### replaceQuery

          public javax.ws.rs.core.UriBuilder replaceQuery​(String query)
                                                   throws IllegalArgumentException

      Specified by:
        `replaceQuery` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### replaceQueryNoEncoding

          public javax.ws.rs.core.UriBuilder replaceQueryNoEncoding​(String query)

    - #### fragment

          public javax.ws.rs.core.UriBuilder fragment​(String fragment)
                                               throws IllegalArgumentException

      Specified by:
        `fragment` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### substitutePathParam

          public javax.ws.rs.core.UriBuilder substitutePathParam​(String name,
                                                                 Object value,
                                                                 boolean isEncoded)

      Only replace path params in path of URI. This changes state of URIBuilder.
      Specified by:
        `substitutePathParam` in class `ResteasyUriBuilder`
      Parameters:
        `name` - parameter name
        `value` - parameter value
        `isEncoded` - encoded flag
      Returns:
        uri builder

    - #### buildFromMap

          public URI buildFromMap​(Map<String,​? extends Object> values)
                           throws IllegalArgumentException,
                                  javax.ws.rs.core.UriBuilderException

      Specified by:
        `buildFromMap` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`
        `javax.ws.rs.core.UriBuilderException`

    - #### buildFromEncodedMap

          public URI buildFromEncodedMap​(Map<String,​? extends Object> values)
                                  throws IllegalArgumentException,
                                         javax.ws.rs.core.UriBuilderException

      Specified by:
        `buildFromEncodedMap` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`
        `javax.ws.rs.core.UriBuilderException`

    - #### buildFromMap

          public URI buildFromMap​(Map<String,​?> values,
                                  boolean encodeSlashInPath)
                           throws IllegalArgumentException,
                                  javax.ws.rs.core.UriBuilderException

      Specified by:
        `buildFromMap` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`
        `javax.ws.rs.core.UriBuilderException`

    - #### buildUriFromMap

          protected URI buildUriFromMap​(Map<String,​? extends Object> paramMap,
                                        boolean fromEncodedMap,
                                        boolean encodeSlash)
                                 throws IllegalArgumentException,
                                        javax.ws.rs.core.UriBuilderException

      Throws:
        `IllegalArgumentException`
        `javax.ws.rs.core.UriBuilderException`

    - #### replacePathParameter

          protected StringBuilder replacePathParameter​(String name,
                                                       String value,
                                                       boolean isEncoded,
                                                       String string,
                                                       StringBuilder builder,
                                                       boolean encodeSlash)

    - #### createUriParamMatcher

          public static Matcher createUriParamMatcher​(String string)

    - #### 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

          public List<String> getPathParamNamesInDeclarationOrder()

      Return a unique order list of path params.
      Specified by:
        `getPathParamNamesInDeclarationOrder` in class `ResteasyUriBuilder`
      Returns:
        list of path parameters

    - #### build

          public URI build​(Object... values)
                    throws IllegalArgumentException,
                           javax.ws.rs.core.UriBuilderException

      Specified by:
        `build` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`
        `javax.ws.rs.core.UriBuilderException`

    - #### buildFromValues

          protected URI buildFromValues​(boolean encodeSlash,
                                        boolean encoded,
                                        Object... values)

    - #### matrixParam

          public javax.ws.rs.core.UriBuilder matrixParam​(String name,
                                                         Object... values)
                                                  throws IllegalArgumentException

      Specified by:
        `matrixParam` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### replaceMatrixParam

          public javax.ws.rs.core.UriBuilder replaceMatrixParam​(String name,
                                                                Object... values)
                                                         throws IllegalArgumentException

      Specified by:
        `replaceMatrixParam` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### clientQueryParam

          public javax.ws.rs.core.UriBuilder clientQueryParam​(String name,
                                                              Object... values)
                                                       throws IllegalArgumentException

      Called by ClientRequest.getUri() to add a query parameter for `@QueryParam` parameters. 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 `@QueryParam` parameters).
      - 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 a `QueryParam` parameter 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:
        `clientQueryParam` in class `ResteasyUriBuilder`
      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

          public javax.ws.rs.core.UriBuilder queryParam​(String name,
                                                        Object... values)
                                                 throws IllegalArgumentException

      Specified by:
        `queryParam` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### replaceQueryParam

          public javax.ws.rs.core.UriBuilder replaceQueryParam​(String name,
                                                               Object... values)
                                                        throws IllegalArgumentException

      Specified by:
        `replaceQueryParam` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### getHost

          public String getHost()

      Specified by:
        `getHost` in class `ResteasyUriBuilder`

    - #### getScheme

          public String getScheme()

      Specified by:
        `getScheme` in class `ResteasyUriBuilder`

    - #### getPort

          public int getPort()

      Specified by:
        `getPort` in class `ResteasyUriBuilder`

    - #### getUserInfo

          public String getUserInfo()

      Specified by:
        `getUserInfo` in class `ResteasyUriBuilder`

    - #### getPath

          public String getPath()

      Specified by:
        `getPath` in class `ResteasyUriBuilder`

    - #### getQuery

          public String getQuery()

      Specified by:
        `getQuery` in class `ResteasyUriBuilder`

    - #### getFragment

          public String getFragment()

      Specified by:
        `getFragment` in class `ResteasyUriBuilder`

    - #### getAuthority

          public String getAuthority()

    - #### getSsp

          public String getSsp()

    - #### segment

          public javax.ws.rs.core.UriBuilder segment​(String... segments)
                                              throws IllegalArgumentException

      Specified by:
        `segment` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### buildFromEncoded

          public URI buildFromEncoded​(Object... values)
                               throws IllegalArgumentException,
                                      javax.ws.rs.core.UriBuilderException

      Specified by:
        `buildFromEncoded` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`
        `javax.ws.rs.core.UriBuilderException`

    - #### replacePath

          public javax.ws.rs.core.UriBuilder replacePath​(String path)

      Specified by:
        `replacePath` in class `javax.ws.rs.core.UriBuilder`

    - #### build

          public URI build​(Object[] values,
                           boolean encodeSlashInPath)
                    throws IllegalArgumentException,
                           javax.ws.rs.core.UriBuilderException

      Specified by:
        `build` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`
        `javax.ws.rs.core.UriBuilderException`

    - #### toTemplate

          public String toTemplate()

      Specified by:
        `toTemplate` in class `javax.ws.rs.core.UriBuilder`

    - #### resolveTemplate

          public javax.ws.rs.core.UriBuilder resolveTemplate​(String name,
                                                             Object value)
                                                      throws IllegalArgumentException

      Specified by:
        `resolveTemplate` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### resolveTemplates

          public javax.ws.rs.core.UriBuilder resolveTemplates​(Map<String,​Object> templateValues)
                                                       throws IllegalArgumentException

      Specified by:
        `resolveTemplates` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### resolveTemplate

          public javax.ws.rs.core.UriBuilder resolveTemplate​(String name,
                                                             Object value,
                                                             boolean encodeSlashInPath)
                                                      throws IllegalArgumentException

      Specified by:
        `resolveTemplate` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### resolveTemplateFromEncoded

          public javax.ws.rs.core.UriBuilder resolveTemplateFromEncoded​(String name,
                                                                        Object value)
                                                                 throws IllegalArgumentException

      Specified by:
        `resolveTemplateFromEncoded` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### resolveTemplates

          public javax.ws.rs.core.UriBuilder resolveTemplates​(Map<String,​Object> templateValues,
                                                              boolean encodeSlashInPath)
                                                       throws IllegalArgumentException

      Specified by:
        `resolveTemplates` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`

    - #### resolveTemplatesFromEncoded

          public javax.ws.rs.core.UriBuilder resolveTemplatesFromEncoded​(Map<String,​Object> templateValues)
                                                                  throws IllegalArgumentException

      Specified by:
        `resolveTemplatesFromEncoded` in class `javax.ws.rs.core.UriBuilder`
      Throws:
        `IllegalArgumentException`