本文整理了Java中org.zkoss.zk.ui.Desktop.getSession()
方法的一些代码示例,展示了Desktop.getSession()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Desktop.getSession()
方法的具体详情如下:
包路径:org.zkoss.zk.ui.Desktop
类名称:Desktop
方法名:getSession
[英]Returns the session of this desktop.
[中]返回此桌面的会话。
代码示例来源:origin: org.zkoss.zk/zk
/** 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);
}
代码示例来源:origin: org.zkoss.zk/zk
private static Session getSession(Component comp) {
final Desktop dt = getDesktop(comp);
return dt != null ? dt.getSession() : null;
}
代码示例来源:origin: org.zkoss.zk/zk
public Session getSession() {
return _desktop != null ? _desktop.getSession() : Sessions.getCurrent();
}
代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core
/**
* Remove desktop security context on desktop cleanup.
*/
@Override
public void onCleanup(Desktop desktop) {
HttpSession session = (HttpSession) desktop.getSession().getNativeSession();
session.removeAttribute(getDesktopContextKey(desktop.getId()));
}
代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core
/**
* 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);
}
代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core
/**
* 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());
}
代码示例来源:origin: org.zkoss.zk/zk
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);
}
}
代码示例来源:origin: org.zkoss.zk/zk
/** 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());
}
代码示例来源:origin: org.zkoss.zk/zk
if (autoTimeout != null ? autoTimeout.booleanValue() : wapp.getConfiguration().isAutomaticTimeout(deviceType)) {
if (desktop != null) {
tmout = desktop.getSession().getMaxInactiveInterval();
} else {
Object req = exec.getNativeRequest();
代码示例来源:origin: org.zkoss.zk/zk
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();
}
代码示例来源:origin: org.zkoss.zk/zk
case SESSION_SCOPE:
if (_page != null)
return _page.getDesktop().getSession().getAttributes();
return Collections.emptyMap();
case APPLICATION_SCOPE:
代码示例来源:origin: org.zkoss.zk/zk
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;
代码示例来源:origin: org.zkoss.zk/zk
/** 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;
}
}
代码示例来源:origin: org.zkoss.zk/zk
final SessionCtrl sessCtrl = (SessionCtrl) desktop.getSession();
if (sessCtrl.isInvalidated())
sessCtrl.invalidateNow();
代码示例来源:origin: org.zkoss.zk/zk
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)
代码示例来源:origin: org.zkoss.zk/zk
final Session sess = desktop.getSession();
final ExecutionMonitor execmon = desktop.getWebApp().getConfiguration().getExecutionMonitor();
final String seqId = resultOfRepeat != null ? ((ExecutionCtrl) exec).getRequestId() : null;
代码示例来源:origin: org.zkoss.zk/zk
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;
代码示例来源:origin: org.zkoss.zk/zk
/** 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;
}
内容来源于网络,如有侵权,请联系作者删除!