Class MediaTypeParamApiVersionResolver
java.lang.Object
org.springframework.web.accept.MediaTypeParamApiVersionResolver
- All Implemented Interfaces:
ApiVersionResolver
ApiVersionResolver that extracts the version from a media type
parameter found in the Accept or Content-Type headers.- Since:
- 7.0
- Author:
- Rossen Stoyanchev
-
Constructor Summary
ConstructorsConstructorDescriptionMediaTypeParamApiVersionResolver(MediaType compatibleMediaType, String paramName) Create an instance. -
Method Summary
Modifier and TypeMethodDescriptionresolveVersion(jakarta.servlet.http.HttpServletRequest request) Resolve the version for the given request.
-
Constructor Details
-
MediaTypeParamApiVersionResolver
Create an instance.- Parameters:
compatibleMediaType- the media type to extract the parameter from with the match established viaMediaType.isCompatibleWith(MediaType)paramName- the name of the parameter
-
-
Method Details
-
resolveVersion
Description copied from interface:ApiVersionResolverResolve the version for the given request.- Specified by:
resolveVersionin interfaceApiVersionResolver- Parameters:
request- the current request- Returns:
- the version value, or
nullif not found
-