java.lang.Object
org.springframework.cloud.servicebroker.autoconfigure.web.servlet.ApiVersionInterceptor
All Implemented Interfaces:
HandlerInterceptor

public class ApiVersionInterceptor extends Object implements HandlerInterceptor
HandlerInterceptor that inspects the service broker API version passed in all request headers and compares it to the API version supported by the broker.
Author:
Scott Frederick
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct an interceptor that disables API version validation.
    ApiVersionInterceptor(org.springframework.cloud.servicebroker.model.BrokerApiVersion version)
    Construct an interceptor that validates the API version passed in request headers to the configured version.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    preHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler)
    Compares the service broker API version header to the supported version.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.web.servlet.HandlerInterceptor

    afterCompletion, postHandle
  • Constructor Details

    • ApiVersionInterceptor

      public ApiVersionInterceptor()
      Construct an interceptor that disables API version validation.
    • ApiVersionInterceptor

      public ApiVersionInterceptor(org.springframework.cloud.servicebroker.model.BrokerApiVersion version)
      Construct an interceptor that validates the API version passed in request headers to the configured version.
      Parameters:
      version - the API version supported by the broker.
  • Method Details

    • preHandle

      public boolean preHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler)
      Compares the service broker API version header to the supported version.
      Specified by:
      preHandle in interface HandlerInterceptor
      Parameters:
      request -
      response -
      handler -
      Throws:
      org.springframework.cloud.servicebroker.exception.ServiceBrokerApiVersionException - if the API version header value does not match the version supported by the broker