Polish "Get content as String for ContentCachingRequestWrapper"
See gh-30709
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -198,8 +198,14 @@ public class ContentCachingRequestWrapper extends HttpServletRequestWrapper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cached request content as a String. The Charset used to decode
|
||||
* the cached content is the same as returned by getCharacterEncoding.
|
||||
* Return the cached request content as a String, using the configured
|
||||
* {@link Charset}.
|
||||
* <p><strong>Note:</strong> The String returned from this method
|
||||
* reflects the amount of content that has been read at the time when it
|
||||
* is called. If the application does not read the content, this method
|
||||
* returns an empty String.
|
||||
* @since 6.1
|
||||
* @see #getContentAsByteArray()
|
||||
*/
|
||||
public String getContentAsString() {
|
||||
return this.cachedContent.toString(Charset.forName(getCharacterEncoding()));
|
||||
|
||||
Reference in New Issue
Block a user