クラス ContentCachingRequestWrapper
java.lang.ObjectSE
jakarta.servlet.ServletRequestWrapper
jakarta.servlet.http.HttpServletRequestWrapper
org.springframework.web.util.ContentCachingRequestWrapper
- 実装済みのインターフェース一覧:
jakarta.servlet.http.HttpServletRequest, jakarta.servlet.ServletRequest
public class ContentCachingRequestWrapper
extends jakarta.servlet.http.HttpServletRequestWrapper
入力ストリームとリーダーから読み取られたすべてのコンテンツをキャッシュし、このコンテンツを
byte array 経由で取得できるようにする HttpServletRequest ラッパー。 このクラスは、コンテンツの読み取り時にのみコンテンツをキャッシュするインターセプターとして機能しますが、それ以外の場合はコンテンツが読み取られません。つまり、リクエストコンテンツが消費されない場合、コンテンツはキャッシュされず、getContentAsByteArray() を介して取得できません。
たとえば、AbstractRequestLoggingFilter によって使用されます。
- 導入:
- 4.1.3
- 作成者:
- Juergen Hoeller, Brian Clozel
- 関連事項:
フィールド概要
インターフェース jakarta.servlet.http.HttpServletRequest から継承されたフィールド
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTHコンストラクター概要
コンストラクターコンストラクター説明ContentCachingRequestWrapper(jakarta.servlet.http.HttpServletRequest request, int cacheLimit) 指定されたサーブレットリクエストに対して新しい ContentCachingRequestWrapper を作成します。方法の概要
修飾子と型メソッド説明byte[]キャッシュされたリクエストコンテンツをバイト配列として返します。構成されたCharsetSE を使用して、キャッシュされたリクエストのコンテンツを文字列として返します。jakarta.servlet.ServletInputStreamgetParameter(StringSE name) StringSE[]getParameterValues(StringSE name) protected voidhandleContentOverflow(int contentCacheLimit) コンテンツオーバーフローを処理するためのテンプレートメソッド: 具体的には、指定されたコンテンツキャッシュの制限を超えて読み取られるリクエスト本文。クラス jakarta.servlet.http.HttpServletRequestWrapper から継承されたメソッド
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgradeクラス jakarta.servlet.ServletRequestWrapper から継承されたメソッド
getAsyncContext, getAttribute, getAttributeNames, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getProtocolRequestId, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setCharacterEncoding, setRequest, startAsync, startAsyncクラス ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, toString, wait, waitSE, waitSEインターフェース jakarta.servlet.ServletRequest から継承されたメソッド
getAsyncContext, getAttribute, getAttributeNames, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getProtocolRequestId, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setCharacterEncoding, startAsync, startAsync
コンストラクターの詳細
ContentCachingRequestWrapper
public ContentCachingRequestWrapper(jakarta.servlet.http.HttpServletRequest request, int cacheLimit) 指定されたサーブレットリクエストに対して新しい ContentCachingRequestWrapper を作成します。- パラメーター:
request- 元のサーブレットリクエストcacheLimit- リクエストごとにキャッシュする最大バイト数。値が 0 以下の場合は制限は設定されません。メモリの過剰使用を避けるために具体的な制限を設定することをお勧めします。- 導入:
- 4.3.6
- 関連事項:
方法の詳細
getInputStream
- 次で指定:
- インターフェース
jakarta.servlet.ServletRequest内のgetInputStream - オーバーライド:
- クラス
jakarta.servlet.ServletRequestWrapperのgetInputStream - 例外:
IOExceptionSE
getCharacterEncoding
- 次で指定:
- インターフェース
jakarta.servlet.ServletRequest内のgetCharacterEncoding - オーバーライド:
- クラス
jakarta.servlet.ServletRequestWrapperのgetCharacterEncoding
getReader
- 次で指定:
- インターフェース
jakarta.servlet.ServletRequest内のgetReader - オーバーライド:
- クラス
jakarta.servlet.ServletRequestWrapperのgetReader - 例外:
IOExceptionSE
getParameter
getParameterMap
getParameterNames
- 次で指定:
- インターフェース
jakarta.servlet.ServletRequest内のgetParameterNames - オーバーライド:
- クラス
jakarta.servlet.ServletRequestWrapperのgetParameterNames
getParameterValues
getContentAsByteArray
public byte[] getContentAsByteArray()キャッシュされたリクエストコンテンツをバイト配列として返します。返される配列がコンテンツキャッシュの制限を超えることはありません。
注意 : このメソッドから返されるバイト配列は、呼び出された時点で読み取られたコンテンツの量を反映しています。アプリケーションがコンテンツを読み取らない場合、このメソッドは空の配列を返します。
- 関連事項:
getContentAsString
handleContentOverflow
protected void handleContentOverflow(int contentCacheLimit) コンテンツオーバーフローを処理するためのテンプレートメソッド: 具体的には、指定されたコンテンツキャッシュの制限を超えて読み取られるリクエスト本文。デフォルトの実装は空です。サブクラスはこれをオーバーライドして、ペイロードが大きすぎる例外などをスローします。
- パラメーター:
contentCacheLimit- 超過したリクエストごとのキャッシュする最大バイト数- 導入:
- 4.3.6
- 関連事項: