public void process(Session sess, ServletContext ctx, HttpServletRequest request, HttpServletResponse response, String pi) throws ServletException, IOException { if (sess == null) { response.setIntHeader("ZK-Error", response.SC_GONE); //denote timeout //Not use response.sendError to avoid being processed by browser return; } final SessionCtrl sessCtrl = (SessionCtrl)sess; sessCtrl.notifyClientRequest(false); //note: it won't invalidate it now but set a flag process0(sess, request, response); if (sessCtrl.isInvalidated()) sessCtrl.invalidateNow(); } private void process0(Session sess,
public void sessionDestroyed(Session sess) { final SessionCtrl sessCtrl = (SessionCtrl) sess; final DesktopCache dc = sessCtrl.getDesktopCache(); if (dc != null) { sessCtrl.setDesktopCache(null); dc.stop(); } }
((SessionCtrl) sess).notifyClientRequest(true); final UiFactory uf = wappc.getUiFactory(); final PageDefinition pagedef = uf.getPageDefinitionDirectly(ri, content, _ext);
if (sessCtrl.isInvalidated()) sessCtrl.invalidateNow();
/** Invokes {@link #getDesktopCache}'s {@link DesktopCache#sessionWillPassivate}. */ public void sessionWillPassivate(Session sess) { final DesktopCache dc = ((SessionCtrl) sess).getDesktopCache(); if (dc != null) dc.sessionWillPassivate(sess); }
public void sessionDestroyed(Session sess) { try { getDesktopCacheProvider().sessionDestroyed(sess); } catch (Throwable ex) { log.warn("Failed to cleanup session", ex); } try { getSessionCache().remove(sess); } catch (Throwable ex) { log.warn("Failed to cleanup session", ex); } try { ((SessionCtrl) sess).onDestroyed(); //after called, sess.getNativeSession() is null! } catch (Throwable ex) { log.warn("Failed to cleanup session", ex); } }
/** Returns the ZK session associated with the specified native session, * or null if not found. * * @param navsess the native session (never null). * If HTTP, it is HttpSession. If portlet, it is PortletSession. * @since 3.0.5 */ public static final Session getSession(WebApp wapp, Object navsess) { final SessionCache sc = ((WebAppCtrl) wapp).getSessionCache(); if (sc == null) return null; //bug 2668190: happens when destroying app in WebSphere 7 final Session sess = sc.get(navsess); if (sess != null && sess.getNativeSession() != navsess) ((SessionCtrl) sess).recover(navsess); return sess; }
((SessionCtrl) sess).notifyClientRequest(keepAlive);
/** Invokes {@link #getDesktopCache}'s {@link DesktopCache#sessionDidActivate}. */ public void sessionDidActivate(Session sess) { final DesktopCache dc = ((SessionCtrl) sess).getDesktopCache(); if (dc != null) dc.sessionDidActivate(sess); }
((SessionCtrl) sess).notifyClientRequest(true);
public DesktopCache getDesktopCache(Session sess) { final SessionCtrl sessCtrl = (SessionCtrl) sess; DesktopCache dc = sessCtrl.getDesktopCache(); if (dc == null) { synchronized (this) { dc = sessCtrl.getDesktopCache(); if (dc == null) { dc = new SimpleDesktopCache(_wapp.getConfiguration()); sessCtrl.setDesktopCache(dc); } } } return dc; }
/** * Returns the desktop from the given websocket session. * * @param wsession websocket session * @return a desktop, null if desktop not found */ public static Desktop getDesktop(Session wsession) { org.zkoss.zk.ui.Session session = (org.zkoss.zk.ui.Session) wsession.getUserProperties() .get(ZKWebSocket.class.getName()); if (session == null) throw new IllegalStateException("ZK Session cannot be null!"); List<String> dtids = wsession.getRequestParameterMap().get("dtid"); if (dtids.isEmpty()) throw new IllegalStateException("the value of the key with 'dtid' cannot be null!"); DesktopCache desktopCache = ((SessionCtrl) session).getDesktopCache(); return desktopCache != null ? desktopCache.getDesktopIfAny(dtids.get(0)) : null; } }
((SessionCtrl) sess).notifyClientRequest(true);
wapp, sess, desktop, request, PageDefinitions.getLocator(wapp, path)); ((SessionCtrl)sess).notifyClientRequest(true);
((SessionCtrl) sess).notifyClientRequest(true);
((SessionCtrl) sess).notifyClientRequest(true);