Commit ac685eba authored by 赵啸非's avatar 赵啸非

修改网关日志

parent 7c79c79e
package com.mortals.xhx.base.framework.filter; package com.mortals.xhx.base.framework.filter;
import cn.hutool.core.net.NetUtil; import cn.hutool.core.net.NetUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.framework.service.MessageProducer; import com.mortals.xhx.base.framework.service.MessageProducer;
import com.mortals.xhx.common.pdu.access.AccessLogPdu; import com.mortals.xhx.common.pdu.access.AccessLogPdu;
import com.mortals.xhx.common.utils.IpUtils; import com.mortals.xhx.common.utils.IpUtils;
import jodd.util.StringUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.reactivestreams.Publisher; import org.reactivestreams.Publisher;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -40,7 +36,6 @@ import org.springframework.web.reactive.function.BodyInserters; ...@@ -40,7 +36,6 @@ import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.server.HandlerStrategies; import org.springframework.web.reactive.function.server.HandlerStrategies;
import org.springframework.web.reactive.function.server.ServerRequest; import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.util.WebUtils;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
...@@ -269,7 +264,7 @@ public class AccessLogFilter implements GlobalFilter, Ordered { ...@@ -269,7 +264,7 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
// 获取响应类型,如果是 json 就打印 // 获取响应类型,如果是 json 就打印
String originalResponseContentType = exchange.getAttribute(ServerWebExchangeUtils.ORIGINAL_RESPONSE_CONTENT_TYPE_ATTR); String originalResponseContentType = exchange.getAttribute(ServerWebExchangeUtils.ORIGINAL_RESPONSE_CONTENT_TYPE_ATTR);
if (ObjectUtil.equal(this.getStatusCode(), HttpStatus.OK) if (ObjectUtil.equal(this.getStatusCode(), HttpStatus.OK)
&& StringUtil.isNotBlank(originalResponseContentType) && StringUtils.isNotBlank(originalResponseContentType)
&& originalResponseContentType.contains("application/json")) { && originalResponseContentType.contains("application/json")) {
Flux<? extends DataBuffer> fluxBody = Flux.from(body); Flux<? extends DataBuffer> fluxBody = Flux.from(body);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment