Class LocalHostUriTemplateHandler

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

public class LocalHostUriTemplateHandler extends org.springframework.boot.web.client.RootUriTemplateHandler
UriTemplateHandler will automatically prefix relative URIs with localhost:${local.server.port}.
Since:
1.4.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    LocalHostUriTemplateHandler(org.springframework.core.env.Environment environment)
    Create a new LocalHostUriTemplateHandler that will generate http URIs using the given environment to determine the context path and port.
    LocalHostUriTemplateHandler(org.springframework.core.env.Environment environment, String scheme)
    Create a new LocalHostUriTemplateHandler that will generate URIs with the given scheme and use the given environment to determine the context-path and port.
    LocalHostUriTemplateHandler(org.springframework.core.env.Environment environment, String scheme, org.springframework.web.util.UriTemplateHandler handler)
    Create a new LocalHostUriTemplateHandler that will generate URIs with the given scheme, use the given environment to determine the context-path and port and delegate to the given template handler.
  • Method Summary

    Modifier and Type
    Method
    Description
     

    Methods inherited from class org.springframework.boot.web.client.RootUriTemplateHandler

    addTo, expand, expand, withHandlerWrapper

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LocalHostUriTemplateHandler

      public LocalHostUriTemplateHandler(org.springframework.core.env.Environment environment)
      Create a new LocalHostUriTemplateHandler that will generate http URIs using the given environment to determine the context path and port.
      Parameters:
      environment - the environment used to determine the port
    • LocalHostUriTemplateHandler

      public LocalHostUriTemplateHandler(org.springframework.core.env.Environment environment, String scheme)
      Create a new LocalHostUriTemplateHandler that will generate URIs with the given scheme and use the given environment to determine the context-path and port.
      Parameters:
      environment - the environment used to determine the port
      scheme - the scheme of the root uri
      Since:
      1.4.1
    • LocalHostUriTemplateHandler

      public LocalHostUriTemplateHandler(org.springframework.core.env.Environment environment, String scheme, org.springframework.web.util.UriTemplateHandler handler)
      Create a new LocalHostUriTemplateHandler that will generate URIs with the given scheme, use the given environment to determine the context-path and port and delegate to the given template handler.
      Parameters:
      environment - the environment used to determine the port
      scheme - the scheme of the root uri
      handler - the delegate handler
      Since:
      2.0.3
  • Method Details

    • getRootUri

      public String getRootUri()
      Overrides:
      getRootUri in class org.springframework.boot.web.client.RootUriTemplateHandler