|
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||
java.lang.Objectnablarch.common.handler.threadcontext.ThreadContextHandler
public class ThreadContextHandler
スレッドコンテキストに保持される共通属性を管理するハンドラ。 フレームワークには、スレッドコンテキストにユーザID・リクエストID・言語設定を保持する実装が含まれている。 これらを有効化するには以下のリポジトリ設定を追加する。 (同様にプロジェクト固有の属性を追加することも可能である。)
<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,
nablarch.fw.ExecutionContext ctx)
このクラスの実装では以下の処理を行う。 |
nablarch.fw.Result |
handleInbound(nablarch.fw.ExecutionContext context)
|
nablarch.fw.Result |
handleOutbound(nablarch.fw.ExecutionContext context)
|
ThreadContextHandler |
setAttributes(java.util.List<ThreadContextAttribute> attributes)
このハンドラが管理する属性のリストを登録する。 |
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| コンストラクタの詳細 |
|---|
public ThreadContextHandler(ThreadContextAttribute... attributes)
このメソッドの処理は以下のソースコードと等価である。
new ThreadContextHandler()
.setAttributes(Arrays.asList(attributes))
attributes - スレッドコンテキスト属性public ThreadContextHandler()
| メソッドの詳細 |
|---|
public java.lang.Object handle(java.lang.Object input,
nablarch.fw.ExecutionContext ctx)
このクラスの実装では以下の処理を行う。
1. スレッドコンテキスト上の全てのエントリを削除する。
2. このハンドラに登録されている全ての属性について、
キー(ThreadContextAttribute#getKey()の結果)と値(ThreadContextAttribute#getValue()の結果)を
スレッドコンテキストに格納する。
3. 後続のリクエストハンドラに処理を委譲する。
nablarch.fw.Handler<java.lang.Object,java.lang.Object> 内の handlepublic ThreadContextHandler setAttributes(java.util.List<ThreadContextAttribute> attributes)
attributes - このハンドラが管理する属性のリスト
public nablarch.fw.Result handleInbound(nablarch.fw.ExecutionContext context)
nablarch.fw.InboundHandleable 内の handleInboundpublic nablarch.fw.Result handleOutbound(nablarch.fw.ExecutionContext context)
nablarch.fw.OutboundHandleable 内の handleOutbound
|
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||