public class DefaultUserDestinationResolver extends ObjectSE implements UserDestinationResolver
SimpUserRegistry
に依存してユーザーのアクティブセッションを見つける UserDestinationResolver
のデフォルト実装。ユーザーがサブスクライブしようとしたとき。"/user/queue/position-updates" には、"/user" プレフィックスが削除され、セッション ID に基づいて一意のサフィックスが追加されます。"/queue/position-updates-useri9oqdfzo" は、異なるユーザーが衝突することなく同じ論理宛先にサブスクライブできるようにします。
ユーザーに送信する場合、例: "/user/{username}/queue/position-updates", "/user/{username}" プレフィックスが削除され、アクティブなセッション ID に基づくサフィックスが追加されます。"/queue/position-updates-useri9oqdfzo"。
コンストラクターと説明 |
---|
DefaultUserDestinationResolver(SimpUserRegistry userRegistry) 提供されたレジストリを介してユーザーセッション ID 情報にアクセスするインスタンスを作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
protected boolean | checkDestination(StringSE destination, StringSE requiredPrefix) |
StringSE | getDestinationPrefix() ユーザー宛先に構成されたプレフィックスを返します。 |
SimpUserRegistry | getSimpUserRegistry() 設定された SimpUserRegistry を返します。 |
protected StringSE | getTargetDestination(StringSE sourceDestination, StringSE actualDestination, StringSE sessionId, StringSE user) このメソッドは、特定のアクティブユーザーセッションのソース「ユーザー」宛先を実際のターゲット宛先に変換する方法を決定します。 |
boolean | isRemoveLeadingSlash() ターゲット宛先から先頭のスラッシュを削除するかどうか。 |
UserDestinationResult | resolveDestination(Message<?> message) ユーザー宛先を指定したメッセージを、実際の宛先を含む 1 つ以上のメッセージ(アクティブなユーザーセッションごとに 1 つ)に解決します。 |
void | setPathMatcher(PathMatcher pathMatcher) 使用すべきではありません。 4.3.14 の時点で、このプロパティは使用されなくなり、 PathMatcher の設定方法にかかわらず、先頭のスラッシュを保持するかどうかを明示的に示す setRemoveLeadingSlash(boolean) に置き換えられます。 |
void | setRemoveLeadingSlash(boolean remove) このプロパティを使用して、変換されたユーザー宛先からの先行スラッシュを削除する必要があるかどうかを示します。 |
void | setUserDestinationPrefix(StringSE prefix) ユーザーの宛先を識別するために使用される接頭辞。 |
StringSE | toString() |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSE
public DefaultUserDestinationResolver(SimpUserRegistry userRegistry)
userRegistry
- レジストリ、null
public SimpUserRegistry getSimpUserRegistry()
SimpUserRegistry
を返します。public void setUserDestinationPrefix(StringSE prefix)
デフォルトのプレフィックスは "/user/" です。
prefix
- 使用する接頭辞 public StringSE getDestinationPrefix()
public void setRemoveLeadingSlash(boolean remove)
デフォルトでは、これは false
に設定されています。つまり、「ターゲットの宛先を変更しないでください」です。ただし、構成された宛先の先頭にスラッシュがない場合、AbstractMessageBrokerConfiguration
は true
に変更することがあります。
remove
- 先頭のスラッシュを削除するかどうか public boolean isRemoveLeadingSlash()
@DeprecatedSE public void setPathMatcher(@Nullable PathMatcher pathMatcher)
PathMatcher
の構成方法に関係なく、先頭のスラッシュを保持するかどうかをより明確に示す setRemoveLeadingSlash(boolean)
に置き換えられました。PathMatcher
を提供します。これは、userDestinationPrefix
を削除した後、先頭のスラッシュを実際の宛先に保持する必要があるかどうかを判断できます。 デフォルトでは、実際の宛先には先頭にスラッシュがあります。/queue/position-updates
は、区切り文字としてスラッシュを使用した宛先をサポートするブローカーで有効です。代替のセパレータをサポートする PathMatcher
が提供されている場合、結果の宛先には先頭にスラッシュがありません。jms.queue.position-updates
。
pathMatcher
- 宛先を操作するために使用される PathMatcher@Nullable public UserDestinationResult resolveDestination(Message<?> message)
UserDestinationResolver
UserDestinationResolver
の resolveDestination
message
- 解決しようとするメッセージ null
。@Nullable protected StringSE getTargetDestination(StringSE sourceDestination, StringSE actualDestination, StringSE sessionId, @Nullable StringSE user)
sourceDestination
- 入力メッセージからのソース宛先。actualDestination
- ユーザー接頭辞のない宛先のサブセット。sessionId
- null
ではなく、アクティブなユーザーセッションの ID。user
- 認証されていない場合など、ターゲットユーザー、おそらく null
。null
public StringSE toString()
ObjectSE
の toStringSE