public class DefaultUserDestinationResolver extends Object implements UserDestinationResolver
UserDestinationResolver
.
Resolves messages sent to destination patterns "/user/{user-name}/**" as well as
subscriptions to destinations "/user/queue/**" where the "/user/" prefix used to
recognize such destinations is customizable via
setUserDestinationPrefix(String)
.
Constructor and Description |
---|
DefaultUserDestinationResolver(UserSessionRegistry userSessionRegistry)
Create an instance that will access user session id information through
the provided registry.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkDestination(String destination,
String requiredPrefix) |
String |
getDestinationPrefix()
Return the prefix used to identify user destinations.
|
String |
getSubscriptionDestinationPrefix()
Return the prefix used to identify user destinations for (un)subscribe messages.
|
protected String |
getTargetDestination(String originalDestination,
String targetDestination,
String sessionId,
String user) |
UserSessionRegistry |
getUserSessionRegistry()
Return the configured
UserSessionRegistry . |
Set<String> |
resolveDestination(Message<?> message)
Resolve the destination of the message to one or more user/session-specific target
destinations.
|
void |
setUserDestinationPrefix(String prefix)
The prefix used to identify user destinations.
|
public DefaultUserDestinationResolver(UserSessionRegistry userSessionRegistry)
userSessionRegistry
- the registry, never null
public void setUserDestinationPrefix(String prefix)
The default value is "/user/".
prefix
- the prefix to usepublic String getDestinationPrefix()
By default "/user/queue/".
public String getSubscriptionDestinationPrefix()
By default "/user/queue/".
public UserSessionRegistry getUserSessionRegistry()
UserSessionRegistry
.public Set<String> resolveDestination(Message<?> message)
UserDestinationResolver
resolveDestination
in interface UserDestinationResolver
message
- the message to resolveprotected String getTargetDestination(String originalDestination, String targetDestination, String sessionId, String user)