Class RootUriTemplateHandler

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

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

    • RootUriTemplateHandler

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

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

      public RootUriTemplateHandler(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 Details

    • expand

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

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

      public String getRootUri()
    • withHandlerWrapper

      public RootUriTemplateHandler withHandlerWrapper(Function<org.springframework.web.util.UriTemplateHandler,org.springframework.web.util.UriTemplateHandler> wrapper)
      Derives a new RootUriTemplateHandler from this one, wrapping its delegate UriTemplateHandler by applying the given wrapper.
      Parameters:
      wrapper - the wrapper to apply to the delegate URI template handler
      Returns:
      the new handler
      Since:
      2.3.10
    • addTo

      public static RootUriTemplateHandler addTo(org.springframework.web.client.RestTemplate restTemplate, 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.