@Singleton public class DefaultHttpHostResolver extends Object implements HttpHostResolver
HttpHostResolver
.Constructor and Description |
---|
DefaultHttpHostResolver(HttpServerConfiguration serverConfiguration,
BeanProvider<EmbeddedServer> embeddedServer) |
Modifier and Type | Method and Description |
---|---|
protected String |
getConfiguredHost(HttpRequest request,
HttpServerConfiguration.HostResolutionConfiguration configuration) |
protected String |
getConfiguredHost(HttpRequest request,
String schemeHeader,
String hostHeader,
String portHeader,
boolean isPortInHost) |
protected String |
getDefaultHost(HttpRequest request) |
protected String |
getEmbeddedHost() |
String |
resolve(HttpRequest request)
Returns the host of the current server with
protocol, host name, and an optional port.
|
protected String |
validateHost(String host)
Validates the host transforming the host value if necessary.
|
@Inject public DefaultHttpHostResolver(HttpServerConfiguration serverConfiguration, @Nullable BeanProvider<EmbeddedServer> embeddedServer)
serverConfiguration
- The server configurationembeddedServer
- The embedded server provider@NonNull public String resolve(@Nullable HttpRequest request)
HttpHostResolver
resolve
in interface HttpHostResolver
request
- The current request@NonNull protected String validateHost(@NonNull String host)
host
- The hostprotected String getEmbeddedHost()
protected String getDefaultHost(HttpRequest request)
request
- The current requestprotected String getConfiguredHost(HttpRequest request, HttpServerConfiguration.HostResolutionConfiguration configuration)
request
- The current requestconfiguration
- The configurationprotected String getConfiguredHost(HttpRequest request, String schemeHeader, String hostHeader, String portHeader, boolean isPortInHost)
request
- The current requestschemeHeader
- The scheme or protocol header namehostHeader
- The host header nameportHeader
- The port header nameisPortInHost
- If the port can be part of the host value