org.zkoss.zk.ui.sys
Class SessionsCtrl

java.lang.Object
  extended by org.zkoss.zk.ui.Sessions
      extended by org.zkoss.zk.ui.sys.SessionsCtrl

public class SessionsCtrl
extends Sessions

An additional utilities for implementation related to Session.

Author:
tomyeh

Field Summary
 
Fields inherited from class org.zkoss.zk.ui.Sessions
_cnt, _sess
 
Constructor Summary
protected SessionsCtrl()
           
 
Method Summary
static SessionCtrl getCurrentCtrl()
          Returns the current SessionCtrl.
static java.lang.Object getRawCurrent()
          Returns the current session or the current session resolver.
static Session getSession(WebApp wapp, java.lang.Object navsess)
          Returns the ZK session associated with the specified native session, or null if not found.
static Session newSession(WebApp wapp, java.lang.Object navsess, java.lang.Object request)
          Instantiates a ZK session that is associated with the specified native session and request.
static boolean requestEnter(Session sess)
          Called when a servlet/portlet starts to serve a request.
static void requestExit(Session sess)
          Called when a servlet/portlet completes the service of a request.
static void setCurrent(Session sess)
          Sets the session for the current thread.
static void setCurrent(SessionResolver sr)
          Sets the session for the current thread.
static void setRawCurrent(java.lang.Object rawsess)
          Sets the current session or the current session resolver.
static void updateCount(boolean inc)
          Update the session count.
 
Methods inherited from class org.zkoss.zk.ui.Sessions
getCount, getCurrent, getCurrent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionsCtrl

protected SessionsCtrl()
Method Detail

setCurrent

public static final void setCurrent(Session sess)
Sets the session for the current thread. Called only internally.


setCurrent

public static final void setCurrent(SessionResolver sr)
Sets the session for the current thread. Unlike setCurrent(Session), the session is resolved later (when Sessions.getCurrent() is called).

Since:
5.0.0

getCurrentCtrl

public static final SessionCtrl getCurrentCtrl()
Returns the current SessionCtrl.


getRawCurrent

public static final java.lang.Object getRawCurrent()
Returns the current session or the current session resolver. The returned value is either Session or SessionResolver.

Since:
5.0.0
See Also:
setRawCurrent(java.lang.Object), setCurrent(Session), setCurrent(SessionResolver)

setRawCurrent

public static final void setRawCurrent(java.lang.Object rawsess)
Sets the current session or the current session resolver.

Parameters:
rawsess - the raw session. It can be null, an instance of Session and SessionResolver. Notice: it is usually the return value of getRawCurrent().
Since:
5.0.0
See Also:
getRawCurrent()

updateCount

public static final void updateCount(boolean inc)
Update the session count.

Called only internally.

Since:
5.0.0

requestEnter

public static boolean requestEnter(Session sess)
Called when a servlet/portlet starts to serve a request. It checks whether the number of concurrent requests per session exceeds the number specified in Configuration.getSessionMaxRequests(). If exceeded, false is returned, and the servlet/portlet shall stop processing and return an error code back the client.

If not exceeded, true is returned, and the servlet/portlet can continue the processing and it shall invoke requestExit(org.zkoss.zk.ui.Session) in the finally clause.

Since:
3.0.1

requestExit

public static void requestExit(Session sess)
Called when a servlet/portlet completes the service of a request. This method must be called if requestEnter(org.zkoss.zk.ui.Session) is called and returns true. This method shall not be called, otherwise.

Since:
3.0.1

getSession

public static final Session getSession(WebApp wapp,
                                       java.lang.Object navsess)
Returns the ZK session associated with the specified native session, or null if not found.

Parameters:
navsess - the native session (never null). If HTTP, it is HttpSession. If portlet, it is PortletSession.
Since:
3.0.5

newSession

public static final Session newSession(WebApp wapp,
                                       java.lang.Object navsess,
                                       java.lang.Object request)
Instantiates a ZK session that is associated with the specified native session and request.

Parameters:
navsess - the native session (never null). If HTTP, it is HttpSession. If portlet, it is PortletSession.
Since:
3.0.5


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo