|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zk.ui.http.SimpleSession
public class SimpleSession
A non-serializable implementation of Session.
Note:
Though this class is serializable, it is meaningless to serialize
it directly. Reason: it doesn't serialize any session attributes.
Rather, it is serialized when Web server serialized HttpSession.
Also, notice that SimpleSession is stored as an attribute
HttpSession.
| Constructor Summary | |
|---|---|
protected |
SimpleSession()
Used by the deriving class, only if the deriving class implements java.io.Serializable. |
|
SimpleSession(WebApp wapp,
javax.servlet.http.HttpSession hsess,
java.lang.String clientAddr,
java.lang.String clientHost)
|
| Method Summary | |
|---|---|
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of the specified custom attribute. |
java.util.Map |
getAttributes()
Returns a map of custom attributes associated with this session. |
java.lang.String |
getClientAddr()
Returns the Internet Protocol (IP) address of the client that creates this session. |
java.lang.String |
getClientHost()
Returns the fully qualified name of the client that creates this session. |
DesktopCache |
getDesktopCache()
Returns the desktop cache, or null if not available. |
java.lang.String |
getDeviceType()
Returns the device type that this session belongs to. |
int |
getMaxInactiveInterval()
Return the time, in seconds, between client requests before the servlet container will invalidate this session. |
java.lang.Object |
getNativeSession()
Returns the native session, or null if not available. |
int |
getNextUuidGroup(int groupSize)
Returns a sequence of UUID for DesktopCtrl.getNextUuid()
to generate component UUID. |
WebApp |
getWebApp()
Returns the Web application that this session belongs to. |
void |
invalidate()
Invalidates this session then unbinds any objects bound to it. |
void |
invalidateNow()
Really invalidates the session. |
boolean |
isInvalidated()
Returns whether this session is invalidated (i.e., Session.invalidate() was called). |
void |
notifyClientRequest(boolean keepAlive)
Notifies the session that a client request is received. |
void |
onDestroyed()
Called when the session is destroyed. |
protected void |
readThis(java.io.ObjectInputStream s)
Used by the deriving class to read back this object, only if the deriving class implements java.io.Serializable. |
void |
recover(java.lang.Object nativeSession)
Called when ZK detects Session.getNativeSession()
is not initialized properly. |
void |
removeAttribute(java.lang.String name)
Removes the specified custom attribute. |
protected void |
sessionDidActivate(javax.servlet.http.HttpSession hsess)
Used by the deriving class to post-process a session after it is read back. |
protected void |
sessionWillPassivate()
Used by the deriving class to pre-process a session before writing the session Refer to SerializableSession for how to use this method. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets the value of the specified custom attribute. |
void |
setDesktopCache(DesktopCache cache)
Sets the desktop cache. |
void |
setDeviceType(java.lang.String deviceType)
Sets the device type that this session belongs to. |
void |
setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. |
protected void |
writeThis(java.io.ObjectOutputStream s)
Used by the deriving class to write this object, only if the deriving class implements java.io.Serializable. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleSession(WebApp wapp,
javax.servlet.http.HttpSession hsess,
java.lang.String clientAddr,
java.lang.String clientHost)
protected SimpleSession()
| Method Detail |
|---|
public java.lang.String getDeviceType()
SessionA device type identifies the type of a client. For example, "ajax" represents the Web browsers with Ajax support, while "mil" represents clients that supports Mobile Interactive markup Language (on Limited Connected Device, such as mobile phones).
All desktops of the same session must belong to the same device type.
The session's device type is determined by the first desktop's device type.
getDeviceType in interface Sessionpublic void setDeviceType(java.lang.String deviceType)
SessionCtrlIt is called by the desktop when Desktop.setDeviceType(java.lang.String)
is called.
Don't call this method directly. Otherwise, the result is inpredictable.
setDeviceType in interface SessionCtrlpublic java.lang.Object getAttribute(java.lang.String name)
Session
getAttribute in interface Session
public void setAttribute(java.lang.String name,
java.lang.Object value)
Session
setAttribute in interface Sessionpublic void removeAttribute(java.lang.String name)
Session
removeAttribute in interface Sessionpublic java.util.Map getAttributes()
Session
getAttributes in interface Sessionpublic java.lang.String getClientAddr()
Session
getClientAddr in interface Sessionpublic java.lang.String getClientHost()
Session
getClientHost in interface Sessionpublic void invalidateNow()
SessionCtrlApplication shall never access this method.
invalidateNow in interface SessionCtrlpublic void setMaxInactiveInterval(int interval)
Session
setMaxInactiveInterval in interface SessionConfiguration.setTimerKeepAlive(boolean),
Configuration.setSessionMaxInactiveInterval(int)public int getMaxInactiveInterval()
Session
getMaxInactiveInterval in interface SessionConfiguration.isTimerKeepAlive(),
Configuration.getSessionMaxInactiveInterval()public java.lang.Object getNativeSession()
Session
getNativeSession in interface Sessionpublic void notifyClientRequest(boolean keepAlive)
SessionCtrl
notifyClientRequest in interface SessionCtrlkeepAlive - if the request will keep the session alive,
or the request shall be ignored.
If the request shall be ignored and the session is timeout,
it will cause the session to expire (i.e., be invalidated).public int getNextUuidGroup(int groupSize)
SessionCtrlDesktopCtrl.getNextUuid()
to generate component UUID.
getNextUuidGroup in interface SessionCtrlgroupSize - how many number of UUID the caller wants.public final WebApp getWebApp()
Session
getWebApp in interface Sessionpublic final void invalidate()
SessionNote: you usually have to ask the client to redirect to another page
(or reload the same page) by use of Executions.sendRedirect(java.lang.String).
The session is not invalidated immediately. Rather, it is invalidated after processing the current request.
invalidate in interface Sessionpublic final boolean isInvalidated()
SessionCtrlSession.invalidate() was called).
isInvalidated in interface SessionCtrlpublic DesktopCache getDesktopCache()
SessionCtrlNote: this is an utility to implement DesktopCacheProvider,
which might or might not use this method. Other part of ZK shall not
access this method.
getDesktopCache in interface SessionCtrlpublic void setDesktopCache(DesktopCache cache)
SessionCtrlNote: this is an utility to implement DesktopCacheProvider,
which might or might not use this method. Other part of ZK shall not
access this method.
setDesktopCache in interface SessionCtrlcache - the desktop cache; null to denote no cache available.public void recover(java.lang.Object nativeSession)
SessionCtrlSession.getNativeSession()
is not initialized properly.
It is actually a workaround to solve the issue that some Web contrainer fails to call HttpSessionActivationListener.sessionDidActivate() unpon failover.
recover in interface SessionCtrlpublic void onDestroyed()
SessionCtrlApplication shall never access this method.
onDestroyed in interface SessionCtrl
protected void writeThis(java.io.ObjectOutputStream s)
throws java.io.IOException
Refer to SerializableSession for how to use this method.
java.io.IOException
protected void readThis(java.io.ObjectInputStream s)
throws java.io.IOException,
java.lang.ClassNotFoundException
Refer to SerializableSession for how to use this method.
java.io.IOException
java.lang.ClassNotFoundExceptionprotected void sessionWillPassivate()
Refer to SerializableSession for how to use this method.
protected void sessionDidActivate(javax.servlet.http.HttpSession hsess)
Application shall not call this method directly.
Refer to SerializableSession for how to use this method.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||