2024年3月29日发(作者:)

ServerHttpResponseDecorator decoratedResponse = new ServerHttpResponseDecorator(originalResponse) {

@Override

public Mono writeWith(Publisher body) {

if (body instanceof Flux) {

Flux fluxBody = (Flux) body;

return ith(().map(dataBuffer -> {

DataBufferFactory dataBufferFactory = new DefaultDataBufferFactory();

DataBuffer join = (dataBuffer);

byte[] content = new byte[leByteCount()];

(content);

//释放掉内存

e(join);

String s = new String(content, _8);

List strings = ponse().getHeaders().get(T_ENCODING);

if (!y(strings) && ns("gzip")) {

GZIPInputStream gzipInputStream = null;

try {

gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(content), );

StringWriter writer = new StringWriter();

(gzipInputStream, writer, "UTF-8");

s = ng();

} catch (IOException e) {

("====Gzip IO error", e);

} finally {

if (gzipInputStream != null) {

try {

();

} catch (IOException e) {

("===Gzip IO close error", e);

}

}

}

} else {

s = new String(content, _8);

}

("bodyString: {}", s);//打印请求响应值

return (content);

}));

}

return ith(body);

}

};

return (().response(decoratedResponse).build());

}

@Override

public int getOrder() {

return -200;

}

}