reset 回退无用处理

2.X
疯狂的狮子Li 3 years ago
parent 3c15950bc9
commit 2176e88712

@ -1,13 +1,11 @@
package com.ruoyi.gateway.handler;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.gateway.utils.WebFluxUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler;
import org.springframework.cloud.gateway.support.NotFoundException;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.http.server.RequestPath;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.web.server.ResponseStatusException;
import org.springframework.web.server.ServerWebExchange;
@ -23,8 +21,6 @@ import reactor.core.publisher.Mono;
@Configuration
public class GatewayExceptionHandler implements ErrorWebExceptionHandler {
private static final String[] IGNORE_PATH = new String[]{"/favicon.ico"};
@Override
public Mono<Void> handle(ServerWebExchange exchange, Throwable ex) {
ServerHttpResponse response = exchange.getResponse();
@ -44,10 +40,7 @@ public class GatewayExceptionHandler implements ErrorWebExceptionHandler {
msg = "内部服务器错误";
}
RequestPath path = exchange.getRequest().getPath();
if (!StringUtils.equalsAny(path.toString(), IGNORE_PATH)) {
log.error("[网关异常处理]请求路径:{},异常信息:{}", path, ex.getMessage());
}
log.error("[网关异常处理]请求路径:{},异常信息:{}", exchange.getRequest().getPath(), ex.getMessage());
return WebFluxUtils.webFluxResponseWriter(response, msg);
}

Loading…
Cancel
Save