Skip to content

Commit

Permalink
Improve Javadoc of ContentCachingRequestWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoyanchev authored and Zoran0104 committed Aug 20, 2021
1 parent cf04e60 commit 192ce4b
Showing 1 changed file with 11 additions and 1 deletion.
@@ -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.
Expand Down Expand Up @@ -40,9 +40,15 @@
* 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
Expand Down Expand Up @@ -184,6 +190,10 @@ private void writeRequestParametersToCachedContent() {
/**
* 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() {
Expand Down

0 comments on commit 192ce4b

Please sign in to comment.