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 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 Manager
      featureManagerSnapshot - App Configuration Feature Manager snapshot version
      disabledFeaturesHandler - 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:
      preHandle in interface org.springframework.web.servlet.HandlerInterceptor
      Parameters:
      request - current HTTP request
      response - current HTTP response
      handler - the handler (or HandlerMethod) that started asynchronous
      Returns:
      true if the @FeatureOn annotation is on or the feature is enabled. Else, it returns false, or is redirected.