クラス RequestContextHolder
java.lang.ObjectSE
org.springframework.web.context.request.RequestContextHolder
スレッドバインド
RequestAttributes オブジェクトの形式で Web リクエストを公開するホルダークラス。inheritable フラグが true に設定されている場合、現在のスレッドによって生成されたすべての子スレッドによってリクエストが継承されます。RequestContextListener または RequestContextFilter を使用して、現在の Web リクエストを公開します。DispatcherServlet はデフォルトで現在のリクエストをすでに公開していることに注意してください。
- 導入:
- 2.0
- 作成者:
- Juergen Hoeller, Rod Johnson
- 関連事項:
コンストラクターの概要
コンストラクターメソッドのサマリー
修飾子と型メソッド説明static RequestAttributes現在スレッドにバインドされている RequestAttributes を返します。static @Nullable RequestAttributes現在スレッドにバインドされている RequestAttributes を返します。static void現在のスレッドの RequestAttributes をリセットします。static voidsetRequestAttributes(@Nullable RequestAttributes attributes) 指定された RequestAttributes を現在のスレッドにバインドし、子スレッドの継承可能として公開しません。static voidsetRequestAttributes(@Nullable RequestAttributes attributes, boolean inheritable) 指定された RequestAttributes を現在のスレッドにバインドします。
コンストラクターの詳細
RequestContextHolder
public RequestContextHolder()
メソッドの詳細
resetRequestAttributes
public static void resetRequestAttributes()現在のスレッドの RequestAttributes をリセットします。setRequestAttributes
指定された RequestAttributes を現在のスレッドにバインドし、子スレッドの継承可能として公開しません。- パラメーター:
attributes- 公開する RequestAttributes- 関連事項:
setRequestAttributes
public static void setRequestAttributes(@Nullable RequestAttributes attributes, boolean inheritable) 指定された RequestAttributes を現在のスレッドにバインドします。- パラメーター:
attributes- 公開する RequestAttributes、またはスレッドバインドコンテキストをリセットするnullinheritable- RequestAttributes を子スレッドの継承可能として公開するかどうか (InheritableThreadLocalSE を使用する)
getRequestAttributes
現在スレッドにバインドされている RequestAttributes を返します。- 戻り値:
- 現在スレッドにバインドされている RequestAttributes、またはバインドされていない場合は
null
currentRequestAttributes
現在スレッドにバインドされている RequestAttributes を返します。以前にバインドされた RequestAttributes インスタンスがあれば、それを公開します。存在する場合、現在の JSF FacesContext にフォールバックします。
- 戻り値:
- 現在スレッドにバインドされている RequestAttributes
- 例外:
IllegalStateExceptionSE- RequestAttributes オブジェクトが現在のスレッドにバインドされていない場合- 関連事項: