Class MediaTypeParamApiVersionResolver

java.lang.Object
org.springframework.web.reactive.accept.MediaTypeParamApiVersionResolver
All Implemented Interfaces:
ApiVersionResolver

public class MediaTypeParamApiVersionResolver extends Object implements 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 Details

    • MediaTypeParamApiVersionResolver

      public MediaTypeParamApiVersionResolver(org.springframework.http.MediaType compatibleMediaType, String paramName)
      Create an instance.
      Parameters:
      compatibleMediaType - the media type to extract the parameter from with the match established via MediaType.isCompatibleWith(MediaType)
      paramName - the name of the parameter
  • Method Details

    • resolveVersion

      public @Nullable String resolveVersion(org.springframework.web.server.ServerWebExchange exchange)
      Description copied from interface: ApiVersionResolver
      Resolve the version for the given exchange.
      Specified by:
      resolveVersion in interface ApiVersionResolver
      Parameters:
      exchange - the current exchange
      Returns:
      the version value, or null if not found