@Component(value="cuba_Connection") @Scope(value="vaadin") public class ConnectionImpl extends EventRouter implements Connection
Connection implementation for web-client.Connection.StateChangeEvent, Connection.StateChangeListener, Connection.UserSubstitutedEvent, Connection.UserSubstitutionListenerNAME| Constructor and Description |
|---|
ConnectionImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addStateChangeListener(Connection.StateChangeListener listener)
Add a connection listener.
|
void |
addUserSubstitutionListener(Connection.UserSubstitutionListener listener)
Add a user substitution listener.
|
UserSession |
getSession()
Get current user session.
|
boolean |
isAlive()
Check if session is alive on middleware
|
boolean |
isAuthenticated()
Check if the client was authenticated.
|
boolean |
isConnected()
Check if the client is connected to the middleware.
|
void |
login(Credentials credentials)
Authenticates a user, starts session and changes state of the connection.
|
void |
logout()
Log out of the system.
|
void |
removeStateChangeListener(Connection.StateChangeListener listener)
Remove a connection listener.
|
void |
removeUserSubstitutionListener(Connection.UserSubstitutionListener listener)
Remove a user substitution listener.
|
void |
substituteUser(User substitutedUser)
Substitute a user in the current session with another user.
|
addListener, addListener, fireEvent, hasListeners, removeListener, removeListener, removeListenersequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSessionNN, login, loginAnonymous, loginByRememberMeloginAfterExternalAuthentication, logoutExternalAuthenticationpublic void login(Credentials credentials) throws LoginException
Connectionlogin in interface Connectioncredentials - credentialsLoginException - if authentication failspublic void logout()
Connectionlogout in interface Connection@Nullable public UserSession getSession()
ConnectiongetSession in interface Connectionpublic void substituteUser(User substitutedUser)
ConnectionNew user is usually obtained from the current user's substitution list:
see User.getSubstitutions()
substituteUser in interface ConnectionsubstitutedUser - new userpublic boolean isConnected()
ConnectionisConnected in interface Connectionpublic boolean isAuthenticated()
ConnectionisAuthenticated in interface Connectionpublic boolean isAlive()
ConnectionisAlive in interface Connectionpublic void addStateChangeListener(Connection.StateChangeListener listener)
ConnectionaddStateChangeListener in interface Connectionlistener - listener to addpublic void removeStateChangeListener(Connection.StateChangeListener listener)
ConnectionremoveStateChangeListener in interface Connectionlistener - listener to removepublic void addUserSubstitutionListener(Connection.UserSubstitutionListener listener)
ConnectionaddUserSubstitutionListener in interface Connectionlistener - listener to addpublic void removeUserSubstitutionListener(Connection.UserSubstitutionListener listener)
ConnectionremoveUserSubstitutionListener in interface Connectionlistener - listener to remove