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 withlocalhost:${local.server.port}
.- Since:
- 1.4.0
Constructor Summary
Constructors Constructor Description LocalHostUriTemplateHandler(org.springframework.core.env.Environment environment)
Create a newLocalHostUriTemplateHandler
that will generatehttp
URIs using the givenenvironment
to determine the context path and port.LocalHostUriTemplateHandler(org.springframework.core.env.Environment environment, String scheme)
Create a newLocalHostUriTemplateHandler
that will generate URIs with the givenscheme
and use the givenenvironment
to determine the context-path and port.LocalHostUriTemplateHandler(org.springframework.core.env.Environment environment, String scheme, org.springframework.web.util.UriTemplateHandler handler)
Create a newLocalHostUriTemplateHandler
that will generate URIs with the givenscheme
, use the givenenvironment
to determine the context-path and port and delegate to the given templatehandler
.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getRootUri()
Constructor Detail
LocalHostUriTemplateHandler
public LocalHostUriTemplateHandler(org.springframework.core.env.Environment environment)
Create a newLocalHostUriTemplateHandler
that will generatehttp
URIs using the givenenvironment
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 newLocalHostUriTemplateHandler
that will generate URIs with the givenscheme
and use the givenenvironment
to determine the context-path and port.- Parameters:
environment
- the environment used to determine the portscheme
- 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 newLocalHostUriTemplateHandler
that will generate URIs with the givenscheme
, use the givenenvironment
to determine the context-path and port and delegate to the given templatehandler
.- Parameters:
environment
- the environment used to determine the portscheme
- the scheme of the root urihandler
- the delegate handler- Since:
- 2.0.3
Method Detail
getRootUri
public String getRootUri()
- Overrides:
getRootUri
in classorg.springframework.boot.web.client.RootUriTemplateHandler