RequestLogFilter.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:plumdo-stock 作者:
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());
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号