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 SummaryConstructors Constructor Description WebsocketSessionBean()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()voiddestroyChannelToken(String channelToken)List<String>getChannelTokensFor(String channel)<S extends Serializable>
 List<String>getChannelTokensFor(String channel, S user)SerializablegetUserFromChannelToken(String channelToken)booleanisChannelAvailable(String channel)Indicate if the channel mentioned is valid for view scope.booleanisTokenValid(String token)voidregisterToken(String token, WebsocketChannelMetadata metadata)voidregisterWebsocketSession(String token, WebsocketChannelMetadata metadata)
 
- 
- 
- 
Method Detail- 
registerTokenpublic void registerToken(String token, WebsocketChannelMetadata metadata) 
 - 
registerWebsocketSessionpublic void registerWebsocketSession(String token, WebsocketChannelMetadata metadata) 
 - 
isTokenValidpublic boolean isTokenValid(String token) 
 - 
getUserFromChannelTokenpublic Serializable getUserFromChannelToken(String channelToken) 
 - 
isChannelAvailablepublic 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:
 
 - 
getChannelTokensForpublic <S extends Serializable> List<String> getChannelTokensFor(String channel, S user) 
 - 
destroy@PreDestroy public void destroy() 
 - 
destroyChannelTokenpublic void destroyChannelToken(String channelToken) 
 
- 
 
-