org.springframework.boot.web.client

Class RootUriTemplateHandler

  • java.lang.Object
    • org.springframework.boot.web.client.RootUriTemplateHandler
  • All Implemented Interfaces:
    org.springframework.web.util.UriTemplateHandler


    public class RootUriTemplateHandler
    extends java.lang.Object
    implements org.springframework.web.util.UriTemplateHandler
    UriTemplateHandler to set the root for URI that starts with '/'.
    Since:
    1.4.0
    • Constructor Detail

      • RootUriTemplateHandler

        protected RootUriTemplateHandler(org.springframework.web.util.UriTemplateHandler handler)
      • RootUriTemplateHandler

        public RootUriTemplateHandler(java.lang.String rootUri)
        Create a new RootUriTemplateHandler instance.
        Parameters:
        rootUri - the root URI to be used to prefix relative URLs
      • RootUriTemplateHandler

        public RootUriTemplateHandler(java.lang.String rootUri,
                                      org.springframework.web.util.UriTemplateHandler handler)
        Create a new RootUriTemplateHandler instance.
        Parameters:
        rootUri - the root URI to be used to prefix relative URLs
        handler - the delegate handler
    • Method Detail

      • expand

        public java.net.URI expand(java.lang.String uriTemplate,
                                   java.util.Map<java.lang.String,?> uriVariables)
        Specified by:
        expand in interface org.springframework.web.util.UriTemplateHandler
      • expand

        public java.net.URI expand(java.lang.String uriTemplate,
                                   java.lang.Object... uriVariables)
        Specified by:
        expand in interface org.springframework.web.util.UriTemplateHandler
      • getRootUri

        public java.lang.String getRootUri()
      • addTo

        public static RootUriTemplateHandler addTo(org.springframework.web.client.RestTemplate restTemplate,
                                                   java.lang.String rootUri)
        Add a RootUriTemplateHandler instance to the given RestTemplate.
        Parameters:
        restTemplate - the RestTemplate to add the handler to
        rootUri - the root URI
        Returns:
        the added RootUriTemplateHandler.