private void updateResponse(String requestURI, ContentCachingResponseWrapper responseWrapper) throws IOException {
try {
HttpServletResponse rawResponse = (HttpServletResponse) responseWrapper.getResponse();
byte[] body = responseWrapper.getContentAsByteArray();
ServletOutputStream outputStream = rawResponse.getOutputStream();
if (rawResponse.isCommitted()) {
if (body.length > 0) {
StreamUtils.copy(body, outputStream);
}
} else {
if (body.length > 0) {
rawResponse.setContentLength(body.length);
StreamUtils.copy(body, rawResponse.getOutputStream());
}
}
finishResponse(outputStream, body);
} catch (Exception ex) {
logger.error("请求地址为" + requestURI + "的连接返回报文失败,原因是{}", ex.getMessage());
}
}
RequestLogFilter.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:plumdo-stock
作者:
评论列表
文章目录