Aithosa commented on issue #4722:
URL:
https://github.com/apache/servicecomb-java-chassis/issues/4722#issuecomment-2665838258
另外请问下自定义filter的话如何才能让其生效?
按配置默认是启用的,但是看执行结果还有打断点自定义的filter都没有走到过。
```java
import org.apache.servicecomb.core.filter.*;
import org.apache.servicecomb.core.Invocation;
import org.apache.servicecomb.swagger.invocation.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.concurrent.CompletableFuture;
@Component
public class MyHandler extends AbstractFilter implements ConsumerFilter,
EdgeFilter {
private static final Logger LOGGER =
LoggerFactory.getLogger(MyHandler.class);
@Override
public String getName() {
return "myhandler";
}
@Override
public int getOrder() {
return -1999;
}
@Override
public CompletableFuture<Response> onFilter(Invocation invocation,
FilterNode nextNode) {
LOGGER.info("It's my handler! \r\n");
return nextNode.onFilter(invocation);
}
}
···
另外启动时,`org.apache.servicecomb.core.filter.FilterChainsManager`的`collectResolvedChains()`会打印当前的filter,为什么即使是之前的`handler-publickey-auth`示例,也不会打印已经生效的"consumer-public-key"和"provider-public-key"?
看了`下InvocationFilterChains`里也没有"consumer-public-key"和"provider-public-key"。
```java
public String collectResolvedChains() {
StringBuilder sb = new StringBuilder();
appendLine(sb, "consumer: ");
appendLine(sb, " filters: %s", collectFilterNames(consumerChains));
appendLine(sb, "producer: ");
appendLine(sb, " filters: %s", collectFilterNames(providerChains));
appendLine(sb, "edge: ");
appendLine(sb, " filters: %s", collectFilterNames(edgeChains));
return deleteLast(sb, 1).toString();
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]