你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

FeatureHandler Class

  • java.lang.Object
    • com.azure.spring.cloud.feature.management.web.FeatureHandler

Implements

org.springframework.web.servlet.HandlerInterceptor

public class FeatureHandler
implements org.springframework.web.servlet.HandlerInterceptor

Interceptor for Requests to check if they should be run.

Constructor Summary

Constructor Description
FeatureHandler(FeatureManager featureManager, FeatureManagerSnapshot featureManagerSnapshot, DisabledFeaturesHandler disabledFeaturesHandler)

Interceptor for Requests to check if they should be run.

Method Summary

Modifier and Type Method and Description
boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)

Checks if the endpoint being called has the @FeatureOn annotation.

Methods inherited from java.lang.Object

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(HttpServletRequest request, 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.

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.

Applies to