Class ApiVersionInterceptor
java.lang.Object
org.springframework.cloud.servicebroker.autoconfigure.web.servlet.ApiVersionInterceptor
- All Implemented Interfaces:
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
ConstructorDescriptionConstruct an interceptor that disables API version validation.ApiVersionInterceptor
(BrokerApiVersion version) Construct an interceptor that validates the API version passed in request headers to the configured version. -
Method Summary
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
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 interfaceHandlerInterceptor
- Parameters:
request
-response
-handler
-- Throws:
ServiceBrokerApiVersionException
- if the API version header value does not match the version supported by the broker
-