Improve Javadoc of ContentCachingRequestWrapper
Closes gh-27068
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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() {
|
||||
|
||||
Reference in New Issue
Block a user