From b6c2979ceec722a3acc77643743a0b9ba15500ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E7=8E=89=E6=A1=94?= Date: Wed, 6 Nov 2019 15:20:43 +0800 Subject: [PATCH] Update doc for the `HTTP_METHOD_SPECIFY` property item (#1091) --- sentinel-adapter/sentinel-web-servlet/README.md | 3 ++- .../com/alibaba/csp/sentinel/adapter/servlet/CommonFilter.java | 2 +- .../csp/sentinel/adapter/servletmethod/FilterMethodConfig.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sentinel-adapter/sentinel-web-servlet/README.md b/sentinel-adapter/sentinel-web-servlet/README.md index 40bc2e65..bb7362a8 100755 --- a/sentinel-adapter/sentinel-web-servlet/README.md +++ b/sentinel-adapter/sentinel-web-servlet/README.md @@ -39,7 +39,8 @@ public class FilterConfig { registration.addUrlPatterns("/*"); registration.setName("sentinelCommonFilter"); registration.setOrder(1); - + // Set whether to support the specified HTTP method for the filter. + registration.addInitParameter(CommonFilter.HTTP_METHOD_SPECIFY, "false"); return registration; } } diff --git a/sentinel-adapter/sentinel-web-servlet/src/main/java/com/alibaba/csp/sentinel/adapter/servlet/CommonFilter.java b/sentinel-adapter/sentinel-web-servlet/src/main/java/com/alibaba/csp/sentinel/adapter/servlet/CommonFilter.java index 23daf283..c50c85ea 100755 --- a/sentinel-adapter/sentinel-web-servlet/src/main/java/com/alibaba/csp/sentinel/adapter/servlet/CommonFilter.java +++ b/sentinel-adapter/sentinel-web-servlet/src/main/java/com/alibaba/csp/sentinel/adapter/servlet/CommonFilter.java @@ -48,7 +48,7 @@ import com.alibaba.csp.sentinel.util.StringUtil; */ public class CommonFilter implements Filter { - private final static String HTTP_METHOD_SPECIFY = "HTTP_METHOD_SPECIFY"; + public final static String HTTP_METHOD_SPECIFY = "HTTP_METHOD_SPECIFY"; /** * Use the path of the url as the context, if necessary, but pay attention to the number of context EntranceNode */ diff --git a/sentinel-adapter/sentinel-web-servlet/src/test/java/com/alibaba/csp/sentinel/adapter/servletmethod/FilterMethodConfig.java b/sentinel-adapter/sentinel-web-servlet/src/test/java/com/alibaba/csp/sentinel/adapter/servletmethod/FilterMethodConfig.java index d2c9d21f..5759a759 100644 --- a/sentinel-adapter/sentinel-web-servlet/src/test/java/com/alibaba/csp/sentinel/adapter/servletmethod/FilterMethodConfig.java +++ b/sentinel-adapter/sentinel-web-servlet/src/test/java/com/alibaba/csp/sentinel/adapter/servletmethod/FilterMethodConfig.java @@ -16,7 +16,7 @@ public class FilterMethodConfig { FilterRegistrationBean registration = new FilterRegistrationBean(); registration.setFilter(new CommonFilter()); registration.addUrlPatterns("/*"); - registration.addInitParameter("HTTP_METHOD_SPECIFY", "true"); + registration.addInitParameter(CommonFilter.HTTP_METHOD_SPECIFY, "true"); registration.setName("sentinelFilter"); registration.setOrder(1);