Class FeatureHandler
java.lang.Object
com.azure.spring.cloud.feature.management.web.FeatureHandler
- All Implemented Interfaces:
org.springframework.web.servlet.HandlerInterceptor
public class FeatureHandler
extends Object
implements org.springframework.web.servlet.HandlerInterceptor
Interceptor for Requests to check if they should be run.
-
Constructor Summary
ConstructorsConstructorDescriptionFeatureHandler(FeatureManager featureManager, FeatureManagerSnapshot featureManagerSnapshot, DisabledFeaturesHandler disabledFeaturesHandler) Interceptor for Requests to check if they should be run. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.servlet.HandlerInterceptor
afterCompletion, postHandle
-
Constructor Details
-
FeatureHandler
public FeatureHandler(FeatureManager featureManager, FeatureManagerSnapshot featureManagerSnapshot, DisabledFeaturesHandler disabledFeaturesHandler) Interceptor for Requests to check if they should be run.- Parameters:
featureManager- App Configuration Feature ManagerfeatureManagerSnapshot- App Configuration Feature Manager snapshot versiondisabledFeaturesHandler- optional handler for dealing with disabled endpoints.
-
-
Method Details
-
preHandle
public boolean preHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler) Checks if the endpoint being called has the @FeatureOn annotation. Checks if the feature is on. Can redirect if feature is off, or can return the disabled feature handler.- Specified by:
preHandlein interfaceorg.springframework.web.servlet.HandlerInterceptor- Parameters:
request- current HTTP requestresponse- current HTTP responsehandler- the handler (orHandlerMethod) that started asynchronous- Returns:
- true if the @FeatureOn annotation is on or the feature is enabled. Else, it returns false, or is redirected.
-