Class HeaderVersionResolver
java.lang.Object
io.micronaut.web.router.version.resolution.HeaderVersionResolver
- All Implemented Interfaces:
RequestVersionResolver
,VersionResolver<HttpRequest<?>,
String>
@Singleton
@Requires(beans={RoutesVersioningConfiguration.class,HeaderVersionResolverConfiguration.class})
public class HeaderVersionResolver
extends Object
implements RequestVersionResolver
A
RequestVersionResolver
responsible for extracting version from HttpHeaders
.- Since:
- 1.1.0
- Author:
- Bogdan Oros
-
Constructor Summary
ConstructorDescriptionHeaderVersionResolver
(HeaderVersionResolverConfiguration configuration) Creates aRequestVersionResolver
to extract version from request header. -
Method Summary
Modifier and TypeMethodDescriptionresolve
(HttpRequest<?> request) Resolves a version from a given object.
-
Constructor Details
-
HeaderVersionResolver
Creates aRequestVersionResolver
to extract version from request header.- Parameters:
configuration
- A configuration to pick correct request header names.
-
-
Method Details
-
resolve
Description copied from interface:VersionResolver
Resolves a version from a given object.- Specified by:
resolve
in interfaceVersionResolver<HttpRequest<?>,
String> - Parameters:
request
- The type of object to resolve from- Returns:
- An optional object representing the version
-