提交 f9167c3d 编写于 作者: R Rossen Stoyanchev

Improve Javadoc of ContentCachingRequestWrapper

Closes gh-27068
上级 fbf4724d
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -40,9 +40,15 @@ import org.springframework.lang.Nullable;
* the {@linkplain #getInputStream() input stream} and {@linkplain #getReader() reader},
* and allows this content to be retrieved via a {@link #getContentAsByteArray() byte array}.
*
* <p>This class acts as an interceptor that only caches content as it is being
* read but otherwise does not cause content to be read. That means if the request
* content is not consumed, then the content is not cached, and cannot be
* retrieved via {@link #getContentAsByteArray()}.
*
* <p>Used e.g. by {@link org.springframework.web.filter.AbstractRequestLoggingFilter}.
* Note: As of Spring Framework 5.0, this wrapper is built on the Servlet 3.1 API.
*
*
* @author Juergen Hoeller
* @author Brian Clozel
* @since 4.1.3
......@@ -184,6 +190,10 @@ public class ContentCachingRequestWrapper extends HttpServletRequestWrapper {
/**
* Return the cached request content as a byte array.
* <p>The returned array will never be larger than the content cache limit.
* <p><strong>Note:</strong> The byte array returned from this method
* reflects the amount of content that has has been read at the time when it
* is called. If the application does not read the content, this method
* returns an empty array.
* @see #ContentCachingRequestWrapper(HttpServletRequest, int)
*/
public byte[] getContentAsByteArray() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册