Class UriBuilderImpl


  • public class UriBuilderImpl
    extends jakarta.ws.rs.core.UriBuilder
    Author:
    Bill Burke
    • Field Detail

      • opaqueUri

        public static final Pattern opaqueUri
      • hierarchicalUri

        public static final Pattern hierarchicalUri
    • Constructor Detail

      • UriBuilderImpl

        public UriBuilderImpl()
    • Method Detail

      • clone

        public jakarta.ws.rs.core.UriBuilder clone()
        Specified by:
        clone in class jakarta.ws.rs.core.UriBuilder
      • compare

        public static boolean compare​(String s1,
                                      String s2)
      • relativize

        public static URI relativize​(URI from,
                                     URI to)
      • fromTemplate

        public static UriBuilderImpl fromTemplate​(String uriTemplate)
        You may put path parameters anywhere within the uriTemplate except port.
        Parameters:
        uriTemplate - uri template
        Returns:
        uri builder
      • uriTemplate

        public jakarta.ws.rs.core.UriBuilder uriTemplate​(CharSequence uriTemplate)
        You may put path parameters anywhere within the uriTemplate except port.
        Parameters:
        uriTemplate - uri template
        Returns:
        uri builder
      • parseHierarchicalUri

        protected jakarta.ws.rs.core.UriBuilder parseHierarchicalUri​(CharSequence uriTemplate,
                                                                     Matcher match)
      • userInfo

        public jakarta.ws.rs.core.UriBuilder userInfo​(String ui)
        Specified by:
        userInfo in class jakarta.ws.rs.core.UriBuilder
      • paths

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

        public jakarta.ws.rs.core.UriBuilder substitutePathParam​(String name,
                                                                 Object value,
                                                                 boolean isEncoded)
        Only replace path params in path of URI. This changes state of URIBuilder.
        Parameters:
        name - parameter name
        value - parameter value
        isEncoded - encoded flag
        Returns:
        uri builder
      • buildFromMap

        public URI buildFromMap​(Map<String,​?> values,
                                boolean encodeSlashInPath)
                         throws IllegalArgumentException,
                                jakarta.ws.rs.core.UriBuilderException
        Specified by:
        buildFromMap in class jakarta.ws.rs.core.UriBuilder
        Throws:
        IllegalArgumentException
        jakarta.ws.rs.core.UriBuilderException
      • createUriParamMatcher

        public static Matcher createUriParamMatcher​(String string)
      • getPathParamNamesInDeclarationOrder

        public List<String> getPathParamNamesInDeclarationOrder()
        Return a unique order list of path params.
        Returns:
        list of path parameters
      • buildFromValues

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

        public jakarta.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).
        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
      • getHost

        public String getHost()
      • getScheme

        public String getScheme()
      • getPort

        public int getPort()
      • getUserInfo

        public String getUserInfo()
      • getPath

        public String getPath()
      • getQuery

        public String getQuery()
      • getFragment

        public String getFragment()
      • buildFromEncoded

        public URI buildFromEncoded​(Object... values)
                             throws IllegalArgumentException,
                                    jakarta.ws.rs.core.UriBuilderException
        Specified by:
        buildFromEncoded in class jakarta.ws.rs.core.UriBuilder
        Throws:
        IllegalArgumentException
        jakarta.ws.rs.core.UriBuilderException
      • replacePath

        public jakarta.ws.rs.core.UriBuilder replacePath​(String path)
        Specified by:
        replacePath in class jakarta.ws.rs.core.UriBuilder
      • toTemplate

        public String toTemplate()
        Specified by:
        toTemplate in class jakarta.ws.rs.core.UriBuilder
      • multiQueryParamMode

        public jakarta.ws.rs.core.UriBuilder multiQueryParamMode​(MultiQueryParamMode mode)