public Object getAttribute(String name, boolean recurse) { Object val = getAttribute(name); return val != null || !recurse || _wapp == null ? val : _wapp.getAttribute(name, true); }
/** * Returns the edition whether valid or invalid. * @since 6.5.5 */ public static boolean isEditionValid() { WebApp current = WebApps.getCurrent(); return !("CE".equals(getEdition()) || current == null || current.getAttribute("org.zkoss.zk.ui.notice") == null); }
public void stop(WebApp wapp) { DesktopCache dc = (DesktopCache) wapp.getAttribute(ATTR_CACHE); if (dc != null) { wapp.removeAttribute(ATTR_CACHE); dc.stop(); } } }
@SuppressWarnings("unchecked") private static Map<String, EntityManagerFactory> getEmfMap() { Map map = (Map) getWebApp().getAttribute(JPA_EMF_MAP); if (map == null) { map = new HashMap(); getWebApp().setAttribute(JPA_EMF_MAP, map); } return map; }
public DesktopCache getDesktopCache(Session sess) { final WebApp wapp = sess.getWebApp(); DesktopCache dc = (DesktopCache) wapp.getAttribute(ATTR_CACHE); if (dc == null) { synchronized (this) { dc = (DesktopCache) wapp.getAttribute(ATTR_CACHE); if (dc == null) { dc = new SimpleDesktopCache(sess.getWebApp().getConfiguration()); wapp.setAttribute(ATTR_CACHE, dc); } } } return dc; }
/** Returns the AU extension that is associated the specified prefix. * @since 5.0.0 */ public static final AuExtension getAuExtension(WebApp wapp, String prefix) { DHtmlUpdateServlet upsv = DHtmlUpdateServlet.getUpdateServlet(wapp); if (upsv == null) { synchronized (DHtmlUpdateServlet.class) { upsv = DHtmlUpdateServlet.getUpdateServlet(wapp); if (upsv == null) { Map aues = (Map) wapp.getAttribute(ATTR_AU_PROCESSORS); return aues != null ? (AuExtension) aues.get(prefix) : null; } } } return upsv.getAuExtension(prefix); }
public Object getAttribute(String name, boolean recurse) { Object val = getAttribute(name); if (val != null || !recurse || hasAttribute(name)) return val; if (_sess != null) return _sess.getAttribute(name, true); if (_wapp != null) return _wapp.getAttribute(name, true); return null; }
Object notice = webApp.getAttribute("org.zkoss.zk.ui.client.notice"); if (notice instanceof String) { rcs += '\n' + ((String) notice); Object notice = webApp.getAttribute("org.zkoss.zk.ui.client.notice"); if (notice instanceof String) { out.write((String) notice);
public ThreadLocalListener() { final WebApp app = Executions.getCurrent().getDesktop().getWebApp(); _fieldsMap = cast((Map) app.getAttribute("zkplus.util.ThreadLocalListener.fieldsMap")); _enabled = app.getConfiguration().isEventThreadEnabled(); if (_fieldsMap == null) { _fieldsMap = new HashMap<String, String[]>(8); final String PREF = "zkplus.util.ThreadLocalListener.fieldsMap"; app.setAttribute(PREF, _fieldsMap); //read preference String val = app.getConfiguration().getPreference("ThreadLocal", null); if (val == null) val = Library.getProperty(PREF); if (val != null) { final Collection klassSets = CollectionsX.parse(null, val, ';'); for (Iterator its = klassSets.iterator(); its.hasNext();) { final String klassSetStr = (String) its.next(); final Collection klassSet = CollectionsX.parse(null, klassSetStr, '='); final Iterator itz = klassSet.iterator(); final String klass = (String) itz.next(); final String fieldsStr = (String) itz.next(); final Collection<String> fields = CollectionsX.parse(null, fieldsStr, ','); _fieldsMap.put(klass, fields.toArray(new String[fields.size()])); } } } _threadLocalsMap = new HashMap<String, Object[]>(_fieldsMap.size()); }
@SuppressWarnings("unchecked") private static final ResourceCache<PageDefinition> getCache(WebApp wapp) { ResourceCache<PageDefinition> cache = (ResourceCache<PageDefinition>) wapp.getAttribute(ATTR_PAGE_CACHE); if (cache == null) { synchronized (PageDefinitions.class) { cache = (ResourceCache) wapp.getAttribute(ATTR_PAGE_CACHE); if (cache == null) { ResourceLoader<PageDefinition> loader = null;
/** Adds an AU extension and associates it with the specified prefix, * even before {@link DHtmlUpdateServlet} is started. * <p>Unlike {@link #addAuExtension(String, AuExtension)}, it can be called * even if the update servlet is not loaded yet ({@link #getUpdateServlet} * returns null). * * <p>If there was an AU extension associated with the same name, the * the old AU extension will be replaced. * @since 5.0.0 */ public static final AuExtension addAuExtension(WebApp wapp, String prefix, AuExtension extension) throws ServletException { DHtmlUpdateServlet upsv = DHtmlUpdateServlet.getUpdateServlet(wapp); if (upsv == null) { synchronized (DHtmlUpdateServlet.class) { upsv = DHtmlUpdateServlet.getUpdateServlet(wapp); if (upsv == null) { checkAuExtension(prefix, extension); Map<String, AuExtension> aues = cast((Map) wapp.getAttribute(ATTR_AU_PROCESSORS)); if (aues == null) wapp.setAttribute(ATTR_AU_PROCESSORS, aues = new HashMap<String, AuExtension>(4)); return aues.put(prefix, extension); } } } return upsv.addAuExtension(prefix, extension); }
WebApp wapp = desktop.getWebApp(); if (wapp == null || "CE".equals(WebApps.getEdition()) || wapp.getAttribute("org.zkoss.zk.ui.notice") != null) { final PI pi = (PI) sess.getAttribute(ATTR_PI); boolean show = pi == null;
final Map aues = (Map) wapp.getAttribute(ATTR_AU_PROCESSORS); if (aues != null) { for (Iterator it = aues.entrySet().iterator(); it.hasNext();) {
sb.append(" PE"); sb.append(' ').append(wapp.getBuild()); Object o = wapp.getAttribute("org.zkoss.zk.ui.notice"); if (o != null) sb.append(o);
Object notice = webApp.getAttribute("org.zkoss.zk.ui.client.notice"); if (notice instanceof String) { out.write((String) notice);