|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.activemath.webapp.base.AppSession
public class AppSession
Represents a User in an HttpSession.
A user is considered logged in when the user object in this session is
not set to the AnonUser.
| Method Summary | |
|---|---|
Object |
attachedObject(String key)
Retrieve an associated object, added with a call to attachObject. |
void |
attachListener(String key,
ActivemathEventListener listener)
Convenience method to attach an event listener to this AppSession. |
void |
attachObject(String key,
Object o)
Associate an object with this AppSession. |
void |
attachShutdownHook(String key,
AppSessionShutdownHook hook)
Convenience method to attach a shutdown hook to this AppSession. |
void |
clearAuthToken()
Remove a token from this session and from AuthenticationManager. |
void |
detachHook(String key)
|
void |
detachListener(String key)
|
void |
detachObject(String key)
Detach an object that has been attached by attachObject(). |
ActivemathEvent[] |
fetchBrowserEvents()
Fetch the queued browser events and clear the queue. |
List<String> |
getAcceptedLanguages()
Languages accepted by the client of this session (derived from browser setting). |
AuthToken |
getAuthToken()
Get the AuthToken for this session, or create one on first access. |
String |
getId()
Synonym to getSessionId() |
String |
getLanguage()
Language to use in this session. |
Book |
getLastUsedBook()
Returns the book for which we received last a PagePresentedEvent. |
String |
getOutputFormat()
Output format to use in this session (see Formatter). |
String |
getSessionId()
Id of HttpSession bound to this session, or null. |
Skin |
getSkin()
Skin to use in this session (can be the default skin). |
User |
getUser()
User object bound to this session. |
long |
getUserStartedTime()
Timestamp when the current user was set. |
boolean |
isLoggedIn()
Say if we have a non-anon user |
void |
onActivemathEvent(ActivemathEvent event)
Handle an ActivemathEvent for this session. |
void |
resetUser()
Reset initial user of this session (AnonUser or null). |
String |
toString()
|
void |
valueBound(HttpSessionBindingEvent event)
Called when the object is bound to a HttpSession |
void |
valueUnbound(HttpSessionBindingEvent event)
Called when the object is unbound from a HttpSession |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public String toString()
toString in class Objectpublic boolean isLoggedIn()
public void valueBound(HttpSessionBindingEvent event)
HttpSession
valueBound in interface HttpSessionBindingListenerpublic void valueUnbound(HttpSessionBindingEvent event)
HttpSession
valueUnbound in interface HttpSessionBindingListener
public void attachObject(String key,
Object o)
ActivemathEventListener,
all events will be forwarded to it.
If the object implements AppSessionShutdownHook,
this will get called when this session is shut down for whatever reason
(and also on detachObject()).
key - object keyo - object to attachpublic Object attachedObject(String key)
attachObject.
null.
public void attachListener(String key,
ActivemathEventListener listener)
attachObject(key, listener).
public void detachListener(String key)
public void attachShutdownHook(String key,
AppSessionShutdownHook hook)
#attachObject(key, hook).
public void detachHook(String key)
public void detachObject(String key)
attachObject().
If the object implements AppSessionShutdownHook,
this is called to inform the object of session shutdown.
key - - object key used by attachObject()public void onActivemathEvent(ActivemathEvent event)
ActivemathEvent for this session.
The following actions are taken:#attachedListeners()).
onActivemathEvent in interface ActivemathEventListenerevent - the event to respond toActivemathEventListener.onActivemathEvent(org.activemath.events.ActivemathEvent)public ActivemathEvent[] fetchBrowserEvents()
ActivemathEvent, possibly empty.public String getSessionId()
HttpSession bound to this session, or null.
public String getId()
getSessionId()
public User getUser()
AnonUser (if anon usage is enabled by config),
or null.
null,
indicating that anon usage is disallowed and user is not logged in.public void resetUser()
public List<String> getAcceptedLanguages()
public Skin getSkin()
null.public String getLanguage()
public String getOutputFormat()
Formatter).
public Book getLastUsedBook()
PagePresentedEvent.
nullpublic long getUserStartedTime()
AnonUser, it's the time when the session started.
For a regular User, it's the time of login.
-1.public AuthToken getAuthToken()
public void clearAuthToken()
AuthenticationManager.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||