diff --git a/fizz-bootstrap/pom.xml b/fizz-bootstrap/pom.xml
index a4c7142..8db531c 100644
--- a/fizz-bootstrap/pom.xml
+++ b/fizz-bootstrap/pom.xml
@@ -12,7 +12,7 @@
com.fizzgate
fizz-bootstrap
- 2.2.0-beta8
+ 2.2.0-beta9
1.8
diff --git a/fizz-common/pom.xml b/fizz-common/pom.xml
index e3276c1..6593347 100644
--- a/fizz-common/pom.xml
+++ b/fizz-common/pom.xml
@@ -5,7 +5,7 @@
fizz-gateway-community
com.fizzgate
- 2.2.0-beta8
+ 2.2.0-beta9
../pom.xml
4.0.0
diff --git a/fizz-core/pom.xml b/fizz-core/pom.xml
index b190420..c70b2de 100644
--- a/fizz-core/pom.xml
+++ b/fizz-core/pom.xml
@@ -5,7 +5,7 @@
fizz-gateway-community
com.fizzgate
- 2.2.0-beta8
+ 2.2.0-beta9
../pom.xml
4.0.0
diff --git a/fizz-core/src/main/java/we/filter/PreprocessFilter.java b/fizz-core/src/main/java/we/filter/PreprocessFilter.java
index ac7329f..82e9dfd 100644
--- a/fizz-core/src/main/java/we/filter/PreprocessFilter.java
+++ b/fizz-core/src/main/java/we/filter/PreprocessFilter.java
@@ -17,15 +17,13 @@
package we.filter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono;
+import we.plugin.FixedPluginFilter;
import we.plugin.FizzPluginFilterChain;
import we.plugin.PluginFilter;
import we.plugin.auth.ApiConfig;
@@ -37,6 +35,7 @@ import we.util.WebUtils;
import javax.annotation.Resource;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.function.Function;
@@ -75,15 +74,22 @@ public class PreprocessFilter extends FizzWebFilter {
if (authRes instanceof ApiConfig) {
ApiConfig ac = (ApiConfig) authRes;
afterAuth(exchange, ac);
+ m = executeFixedPluginFilters(exchange);
+ m = m.defaultIfEmpty(ReactorUtils.NULL);
if (ac.pluginConfigs == null || ac.pluginConfigs.isEmpty()) {
return m.flatMap(func(exchange, chain));
} else {
- eas.put(FizzPluginFilterChain.WEB_FILTER_CHAIN, chain);
- return FizzPluginFilterChain.next(exchange);
+ return m.flatMap(
+ nil -> {
+ eas.put(FizzPluginFilterChain.WEB_FILTER_CHAIN, chain);
+ return FizzPluginFilterChain.next(exchange);
+ }
+ );
}
} else if (authRes == ApiConfigService.Access.YES) {
afterAuth(exchange, null);
- return m.flatMap(func(exchange, chain));
+ m = executeFixedPluginFilters(exchange);
+ return m.defaultIfEmpty(ReactorUtils.NULL).flatMap(func(exchange, chain));
} else {
String err = null;
if (authRes instanceof ApiConfigService.Access) {
@@ -138,4 +144,18 @@ public class PreprocessFilter extends FizzWebFilter {
return chain.filter(exchange);
};
}
+
+ private Mono executeFixedPluginFilters(ServerWebExchange exchange) {
+ Mono vm = Mono.empty();
+ List fixedPluginFilters = FixedPluginFilter.getPluginFilters();
+ for (byte i = 0; i < fixedPluginFilters.size(); i++) {
+ FixedPluginFilter fpf = fixedPluginFilters.get(i);
+ vm = vm.defaultIfEmpty(ReactorUtils.NULL).flatMap(
+ v -> {
+ return fpf.filter(exchange, null, null);
+ }
+ );
+ }
+ return vm;
+ }
}
diff --git a/fizz-core/src/main/java/we/plugin/FixedPluginFilter.java b/fizz-core/src/main/java/we/plugin/FixedPluginFilter.java
index 02ea426..fd51e70 100644
--- a/fizz-core/src/main/java/we/plugin/FixedPluginFilter.java
+++ b/fizz-core/src/main/java/we/plugin/FixedPluginFilter.java
@@ -29,6 +29,7 @@ import java.util.*;
* @author hongqiaowei
*/
+@Deprecated
public abstract class FixedPluginFilter extends PluginFilter {
private static final Logger log = LoggerFactory.getLogger(FixedPluginFilter.class);
diff --git a/fizz-plugin/pom.xml b/fizz-plugin/pom.xml
index 5a95aec..995f2c8 100644
--- a/fizz-plugin/pom.xml
+++ b/fizz-plugin/pom.xml
@@ -5,7 +5,7 @@
fizz-gateway-community
com.fizzgate
- 2.2.0-beta8
+ 2.2.0-beta9
../pom.xml
4.0.0
diff --git a/fizz-spring-boot-starter/pom.xml b/fizz-spring-boot-starter/pom.xml
index 4ef3aab..41986b2 100644
--- a/fizz-spring-boot-starter/pom.xml
+++ b/fizz-spring-boot-starter/pom.xml
@@ -5,7 +5,7 @@
fizz-gateway-community
com.fizzgate
- 2.2.0-beta8
+ 2.2.0-beta9
../pom.xml
4.0.0
diff --git a/pom.xml b/pom.xml
index 213ce5b..be1fb34 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
fizz-gateway-community
${project.artifactId}
fizz gateway community
- 2.2.0-beta8
+ 2.2.0-beta9
pom
fizz-common