Package org.zkoss.zk.ui.sys
Class SessionsCtrl
java.lang.Object
org.zkoss.zk.ui.Sessions
org.zkoss.zk.ui.sys.SessionsCtrl
An additional utilities for implementation related to
Session.- Author:
- tomyeh
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final SessionCtrlReturns the currentSessionCtrl.static final ObjectReturns the current session or the current session resolver.static final SessiongetSession(WebApp wapp, Object navsess) Returns the ZK session associated with the specified native session, or null if not found.static final SessionnewSession(WebApp wapp, Object navsess, Object request) Instantiates a ZK session that is associated with the specified native session and request.static booleanrequestEnter(Session sess) Called when a servlet/portlet starts to serve a request.static voidrequestExit(Session sess) Called when a servlet/portlet completes the service of a request.static final voidsetCurrent(Session sess) Sets the session for the current thread.static final voidSets the session for the current thread.static final voidsetRawCurrent(Object rawsess) Sets the current session or the current session resolver.static final voidupdateCount(boolean inc) Update the session count.Methods inherited from class org.zkoss.zk.ui.Sessions
getCount, getCurrent, getCurrent
-
Constructor Details
-
SessionsCtrl
protected SessionsCtrl()
-
-
Method Details
-
setCurrent
Sets the session for the current thread. Called only internally. -
setCurrent
Sets the session for the current thread. UnlikesetCurrent(Session), the session is resolved later (whenSessions.getCurrent()is called).- Since:
- 5.0.0
-
getCurrentCtrl
Returns the currentSessionCtrl. -
getRawCurrent
Returns the current session or the current session resolver. The returned value is eitherSessionorSessionResolver.- Since:
- 5.0.0
- See Also:
-
setRawCurrent
Sets the current session or the current session resolver.- Parameters:
rawsess- the raw session. It can be null, an instance ofSessionandSessionResolver. Notice: it is usually the return value ofgetRawCurrent().- Since:
- 5.0.0
- See Also:
-
updateCount
public static final void updateCount(boolean inc) Update the session count.Called only internally.
- Since:
- 5.0.0
-
requestEnter
Called when a servlet/portlet starts to serve a request. It checks whether the number of concurrent requests per session exceeds the number specified inConfiguration.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
Called when a servlet/portlet completes the service of a request. This method must be called ifrequestEnter(org.zkoss.zk.ui.Session)is called and returns true. This method shall not be called, otherwise.- Since:
- 3.0.1
-
getSession
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
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
-