public class ThreadContextHandler extends java.lang.Object implements Handler<java.lang.Object,java.lang.Object>, InboundHandleable, OutboundHandleable
<component class="nablarch.common.handler.threadcontext.ThreadContextHandler">
<property name="attributes">
<list>
<!-- ユーザID -->
<component class="nablarch.common.handler.threadcontext.UserIdAttribute">
<property name="sessionKey" value="user.id" />
<property name="anonymousId" value="guest" />
</component>
<!-- リクエストID -->
<component class="nablarch.common.handler.threadcontext.RequestIdAttribute" />
<!-- 言語 -->
<component class="nablarch.common.handler.threadcontext.LanguageAttribute">
<property name="defaultLanguage" value="ja" />
</component>
</list>
</property>
</component>
| コンストラクタと説明 |
|---|
ThreadContextHandler()
デフォルトコンストラクタ
|
ThreadContextHandler(ThreadContextAttribute... attributes)
引数に渡されたスレッドコンテキスト属性を管理するハンドラを生成する。
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
java.lang.Object |
handle(java.lang.Object input,
ExecutionContext ctx)
入力データに対する処理を実行する。
|
Result |
handleInbound(ExecutionContext context)
前処理を実装する。
|
Result |
handleOutbound(ExecutionContext context)
後処理を実装する。
|
ThreadContextHandler |
setAttributes(java.util.List<ThreadContextAttribute> attributes)
このハンドラが管理する属性のリストを登録する。
|
public ThreadContextHandler(ThreadContextAttribute... attributes)
このメソッドの処理は以下のソースコードと等価である。
new ThreadContextHandler()
.setAttributes(Arrays.asList(attributes))
attributes - スレッドコンテキスト属性public ThreadContextHandler()
public java.lang.Object handle(java.lang.Object input,
ExecutionContext ctx)
このクラスの実装では以下の処理を行う。
1. スレッドコンテキスト上の全てのエントリを削除する。
2. このハンドラに登録されている全ての属性について、
キー(ThreadContextAttribute#getKey()の結果)と値(ThreadContextAttribute#getValue()の結果)を
スレッドコンテキストに格納する。
3. 後続のリクエストハンドラに処理を委譲する。
public ThreadContextHandler setAttributes(java.util.List<ThreadContextAttribute> attributes)
attributes - このハンドラが管理する属性のリストpublic Result handleInbound(ExecutionContext context)
InboundHandleablehandleInbound インタフェース内 InboundHandleablecontext - ExecutionContextpublic Result handleOutbound(ExecutionContext context)
OutboundHandleablehandleOutbound インタフェース内 OutboundHandleablecontext - ExecutionContext