Package org.apache.myfaces.push.cdi
Class WebsocketSessionBean
- java.lang.Object
-
- org.apache.myfaces.push.cdi.WebsocketSessionBean
-
- All Implemented Interfaces:
Serializable
@SessionScoped public class WebsocketSessionBean extends Object implements Serializable
The purpose of this bean is to keep track of the active tokens and Session instances in the current session, so it can be possible to decide if the token is valid or not for the current session. If the token is not in application scope and is present in session, it means there was a server restart, so the connection must be updated (added to application scope).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description WebsocketSessionBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
void
destroyChannelToken(String channelToken)
List<String>
getChannelTokensFor(String channel)
<S extends Serializable>
List<String>getChannelTokensFor(String channel, S user)
Serializable
getUserFromChannelToken(String channelToken)
boolean
isChannelAvailable(String channel)
Indicate if the channel mentioned is valid for view scope.boolean
isTokenValid(String token)
void
registerToken(String token, WebsocketChannelMetadata metadata)
void
registerWebsocketSession(String token, WebsocketChannelMetadata metadata)
-
-
-
Method Detail
-
registerToken
public void registerToken(String token, WebsocketChannelMetadata metadata)
-
registerWebsocketSession
public void registerWebsocketSession(String token, WebsocketChannelMetadata metadata)
-
isTokenValid
public boolean isTokenValid(String token)
-
getUserFromChannelToken
public Serializable getUserFromChannelToken(String channelToken)
-
isChannelAvailable
public boolean isChannelAvailable(String channel)
Indicate if the channel mentioned is valid for view scope. A channel is valid if there is at least one token that represents a valid connection to this channel.- Parameters:
channel
-- Returns:
-
getChannelTokensFor
public <S extends Serializable> List<String> getChannelTokensFor(String channel, S user)
-
destroy
@PreDestroy public void destroy()
-
destroyChannelToken
public void destroyChannelToken(String channelToken)
-
-