/** Constructor. * * @param desktop the desktop, never null. * @param request the request, or null if not available. * @param locator the locator used to locate taglib and other resources. * If null, wapp is used. */ public RequestInfoImpl(Desktop desktop, Object request, Locator locator) { this(desktop.getWebApp(), desktop.getSession(), desktop, request, locator); }
private static Session getSession(Component comp) { final Desktop dt = getDesktop(comp); return dt != null ? dt.getSession() : null; }
public Session getSession() { return _desktop != null ? _desktop.getSession() : Sessions.getCurrent(); }
/** * Remove desktop security context on desktop cleanup. */ @Override public void onCleanup(Desktop desktop) { HttpSession session = (HttpSession) desktop.getSession().getNativeSession(); session.removeAttribute(getDesktopContextKey(desktop.getId())); }
/** * Given a desktop, returns Spring security context object. * * @param desktop The desktop whose security context is sought. * @return SecurityContext The Spring security context. */ public static SecurityContext getSecurityContext(Desktop desktop) { String key = getDesktopContextKey(desktop.getId()); HttpSession session = (HttpSession) desktop.getSession().getNativeSession(); return (SecurityContext) session.getAttribute(key); }
/** * Force transfer of session-based security context to desktop. */ @Override public void onInit(Desktop desktop) { HttpSession session = (HttpSession) desktop.getSession().getNativeSession(); getSecurityContext(session, desktop.getId()); }
public void execRecover(Execution exec, FailoverManager failover) { final Desktop desktop = exec.getDesktop(); final Session sess = desktop.getSession(); doActivate(exec, false, true, null, -1); //it must not return null try { failover.recover(sess, exec, desktop); } finally { doDeactivate(exec); } }
/** Setup this processor before processing the event by calling * {@link #process}. * * <p>Note: it doesn't invoke {@link ExecutionCtrl#onActivate} */ public void setup() { SessionsCtrl.setCurrent(_desktop.getSession()); final Execution exec = _desktop.getExecution(); ExecutionsCtrl.setCurrent(exec); ((ExecutionCtrl) exec).setCurrentPage(getPage()); }
if (autoTimeout != null ? autoTimeout.booleanValue() : wapp.getConfiguration().isAutomaticTimeout(deviceType)) { if (desktop != null) { tmout = desktop.getSession().getMaxInactiveInterval(); } else { Object req = exec.getNativeRequest();
public Map<String, Object> getAttributes(int scope) { switch (scope) { case DESKTOP_SCOPE: if (_desktop != null) return _desktop.getAttributes(); break; case SESSION_SCOPE: if (_desktop != null) return _desktop.getSession().getAttributes(); break; case APPLICATION_SCOPE: if (_desktop != null) return _desktop.getWebApp().getAttributes(); case PAGE_SCOPE: return _attrs.getAttributes(); case REQUEST_SCOPE: final Execution exec = getExecution(); if (exec != null) return exec.getAttributes(); } return Collections.emptyMap(); }
case SESSION_SCOPE: if (_page != null) return _page.getDesktop().getSession().getAttributes(); return Collections.emptyMap(); case APPLICATION_SCOPE:
return comp != null ? getDesktop(comp) : page.getDesktop(); if ("session".equals(name)) return comp != null ? getSession(comp) : page.getDesktop().getSession(); if ("application".equals(name)) return comp != null ? getWebApp(comp) : page.getDesktop().getWebApp(); final Session sess = comp != null ? getSession(comp) : page.getDesktop().getSession(); return sess != null ? sess.getAttributes() : Collections.EMPTY_MAP;
/** Called to remove the desktop. * If {@link DesktopRecycle} is configured, {@link DesktopRecycle#beforeRemove} * will be called first to see if it shall be recycled. * @return whether the desktop is removed. Returns false if the desktop * is recycled. */ public static boolean removeDesktop(Execution exec) { final Desktop dt = exec.getDesktop(); final WebApp wapp = dt.getWebApp(); final DesktopRecycle dtrc = wapp.getConfiguration().getDesktopRecycle(); if (dtrc != null) { try { if (dtrc.beforeRemove(exec, dt, 0)) { ((DesktopCtrl) dt).recycle(); return false; //recycled } } catch (Throwable ex) { log.error("", ex); } } ((WebAppCtrl) wapp).getDesktopCache(dt.getSession()).removeDesktop(dt); return true; } }
final SessionCtrl sessCtrl = (SessionCtrl) desktop.getSession(); if (sessCtrl.isInvalidated()) sessCtrl.invalidateNow();
return self; if ("sessionScope".equals(name)) return _exec.getDesktop().getSession().getAttributes(); if ("session".equals(name)) return _exec.getDesktop().getSession(); if ("spaceOwner".equals(name)) { if (self instanceof Component)
final Session sess = desktop.getSession(); final ExecutionMonitor execmon = desktop.getWebApp().getConfiguration().getExecutionMonitor(); final String seqId = resultOfRepeat != null ? ((ExecutionCtrl) exec).getRequestId() : null;
private static void desktopDestroyed(Desktop desktop) { final Session sess = desktop.getSession(); final Execution exec = new ExecutionImpl(desktop.getWebApp().getServletContext(), null, null, desktop, null); final DesktopCtrl desktopCtrl = (DesktopCtrl) desktop;
/** Re-activates for another execution. It is callable only for * creating new page (execNewPage). It is not allowed for async-update. * <p>Note: doActivate cannot handle reactivation. In other words, * the caller has to detect which method to use. */ private static UiVisualizer doReactivate(Execution curExec, UiVisualizer olduv) { final Desktop desktop = curExec.getDesktop(); final Session sess = desktop.getSession(); // if (log.finerable()) log.finer("Re-activating "+desktop); assert olduv.getExecution().getDesktop() == desktop : "old dt: " + olduv.getExecution().getDesktop() + ", new:" + desktop; final UiVisualizer uv = new UiVisualizer(olduv, curExec); final DesktopCtrl desktopCtrl = (DesktopCtrl) desktop; desktopCtrl.setVisualizer(uv); desktopCtrl.setExecution(curExec); final ExecutionCtrl curCtrl = (ExecutionCtrl) curExec; ExecutionsCtrl.setCurrent(curExec); try { curCtrl.onActivate(); } catch (Throwable ex) { //just in case ExecutionsCtrl.setCurrent(olduv.getExecution()); desktopCtrl.setVisualizer(olduv); desktopCtrl.setExecution(olduv.getExecution()); throw UiException.Aide.wrap(ex); } return uv; }