Package io.micronaut.http.server.util
Class DefaultHttpHostResolver
java.lang.Object
io.micronaut.http.server.util.DefaultHttpHostResolver
- All Implemented Interfaces:
HttpHostResolver
Default implementation of
HttpHostResolver
.- Since:
- 1.2.0
- Author:
- James Kleeh
-
Constructor Summary
ConstructorDescriptionDefaultHttpHostResolver
(HttpServerConfiguration serverConfiguration, @Nullable BeanProvider<EmbeddedServer> embeddedServer) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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
resolve
(@Nullable HttpRequest request) Returns the host of the current server with protocol, host name, and an optional port.validateHost
(@NonNull String host) Validates the host transforming the host value if necessary.
-
Constructor Details
-
DefaultHttpHostResolver
@Inject public DefaultHttpHostResolver(HttpServerConfiguration serverConfiguration, @Nullable @Nullable BeanProvider<EmbeddedServer> embeddedServer) - Parameters:
serverConfiguration
- The server configurationembeddedServer
- The embedded server provider
-
-
Method Details
-
resolve
Description copied from interface:HttpHostResolver
Returns the host of the current server with protocol, host name, and an optional port.- Specified by:
resolve
in interfaceHttpHostResolver
- Parameters:
request
- The current request- Returns:
- The host information
-
validateHost
Validates the host transforming the host value if necessary.- Parameters:
host
- The host- Returns:
- The transformed host
-
getEmbeddedHost
- Returns:
- The host resolved from the embedded server
-
getDefaultHost
- Parameters:
request
- The current request- Returns:
- The default host
-
getConfiguredHost
protected String getConfiguredHost(HttpRequest request, HttpServerConfiguration.HostResolutionConfiguration configuration) - Parameters:
request
- The current requestconfiguration
- The configuration- Returns:
- The configured host
-
getConfiguredHost
protected String getConfiguredHost(HttpRequest request, String schemeHeader, String hostHeader, String portHeader, boolean isPortInHost) - Parameters:
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- Returns:
- The configured host
-