org.zkoss.zk.ui.WebApp类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中org.zkoss.zk.ui.WebApp类的一些代码示例,展示了WebApp类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebApp类的具体详情如下:
包路径:org.zkoss.zk.ui.WebApp
类名称:WebApp

WebApp介绍

[英]Represents a Web application. A web application is usually in form of a war file. An application might have multiple Web applications.

In HTTP, Web application represents a servlet context that supports ZK. In other word, a Web application is created if org.zkoss.zk.ui.http.DHtmlLayoutServlet is declared in web.xml.

To get the current Web application, use Desktop#getWebApp.
[中]表示一个Web应用程序。web应用程序通常是war文件的形式。一个应用程序可能有多个Web应用程序。
在HTTP中,Web应用程序表示支持ZK的servlet上下文。换句话说,一个Web应用程序是由组织创建的。zkoss。zk。用户界面。http。DHtmlLayoutServlet是在web中声明的。xml。
要获取当前的Web应用程序,请使用Desktop#getWebApp。

代码示例

代码示例来源:origin: org.zkoss.zk/zk

public void addPage(Page page) {
  //We have to synchronize it due to getPage allows concurrent access
  synchronized (_pages) {
    _pages.add(page);
    if (log.isDebugEnabled())
      log.debug("After added, pages: {}", _pages);
  }
  afterPageAttached(page, this);
  _wapp.getConfiguration().afterPageAttached(page, this);
}

代码示例来源:origin: org.zkoss.zk/zk

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;
}

代码示例来源:origin: org.zkoss.zk/zk

/** Returns the page definition of the specified path, or null if not
 * found or failed to parse.
 *
 * <p>This is the lowest method that other getPageDefinition depends.
 *
 * <p>Dependency: Execution.createComponents -&amp; Execution.getPageDefinition
 * -&amp; UiFactory.getPageDefiition -&amp; PageDefintions.getPageDefinition
 *
 * @param locator the locator used to locate taglib and other resources.
 * If null, wapp is assumed ({@link WebApp} is also assumed).
 */
public static final PageDefinition getPageDefinition(WebApp wapp, Locator locator, String path) {
  wapp.getConfiguration().invokeURIInterceptors(path);
  //give the security a chance to reject
  return ResourceCaches.get(getCache(wapp), wapp.getServletContext(), path, locator);
}

代码示例来源:origin: org.zkoss.zk/zk

public void stop(WebApp wapp) {
    DesktopCache dc = (DesktopCache) wapp.getAttribute(ATTR_CACHE);
    if (dc != null) {
      wapp.removeAttribute(ATTR_CACHE);
      dc.stop();
    }
  }
}

代码示例来源:origin: org.zkoss.zk/zkplus

@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;
}

代码示例来源:origin: org.zkoss.zk/zk

sb.append("\n<!-- ZK ").append(wapp.getVersion());
  if (WebApps.getFeature("ee"))
    sb.append(" EE");
  else if (WebApps.getFeature("pe"))
    sb.append(" PE");
  sb.append(' ').append(wapp.getBuild());
  Object o = wapp.getAttribute("org.zkoss.zk.ui.notice");
  if (o != null)
    sb.append(o);
if (autoTimeout != null ? autoTimeout.booleanValue() : wapp.getConfiguration().isAutomaticTimeout(deviceType)) {
  if (desktop != null) {
    tmout = desktop.getSession().getMaxInactiveInterval();
          tmout = wapp.getConfiguration().getSessionMaxInactiveInterval();
          if (tmout <= 0) //system default
            tmout = hsess.getMaxInactiveInterval();
        tmout = wapp.getConfiguration().getSessionMaxInactiveInterval();
  sb.append(s).append('\n');
Map<String, DataHandlerInfo> dataHandlers = wapp.getConfiguration().getDataHandlers();
Set<Pair<String, String>> scripts = new LinkedHashSet<Pair<String, String>>();
for (DataHandlerInfo info : dataHandlers.values()) {

代码示例来源:origin: org.zkoss.zk/zk

final StringBuffer sb = new StringBuffer(256);
if (exposeVer)
  sb.append("\nzkver('").append(wapp.getVersion()).append("','").append(wapp.getBuild());
else
  sb.append("\nzkver('','");
    .append(Encodes.encodeURL(ctx, reqctx.request, reqctx.response, wapp.getUpdateURI(false)));
  sb.append("ed:'p',");
final Configuration config = wapp.getConfiguration();
int v = config.getProcessingPromptDelay();
if (v != 900)

代码示例来源:origin: org.zkoss.zk/zul

final Map<String, Object> arg = new HashMap<String, Object>();
arg.put("message", message);
arg.put("title", title != null ? title : Executions.getCurrent().getDesktop().getWebApp().getAppName());
arg.put("icon", icon);
  dlg.setFocus(focus);
if (dlg.getDesktop().getWebApp().getConfiguration().isEventThreadEnabled()) {
  try {
    dlg.doModal();

代码示例来源:origin: org.zkoss.zk/zk

try {
  int hours = 8760;
  final ThemeProvider tp = getWebApp().getConfiguration().getThemeProvider();
  if (tp != null) {
    final String p = "~." + path;
    if (tp != null)
      uri = tp.beforeWidgetCSS(exec, uri);
    if (uri != null && getWebApp().getResource(uri) != null)
      _webctx.include(request, HttpBufferedResponse.getInstance(response, sw), uri, null);
  } catch (Throwable ex) {

代码示例来源:origin: org.zkoss.zk/zk

public Object getAttribute(String name, boolean recurse) {
  Object val = getAttribute(name);
  return val != null || !recurse || _wapp == null ? val : _wapp.getAttribute(name, true);
}

代码示例来源:origin: org.zkoss.zk/zk

if (oldnm == null)
  oldnm = "ZK";
final String appnm = desktop.getWebApp().getAppName();
if (!oldnm.equals(appnm)) {
  sb.append("zk.appName='");
  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;

代码示例来源:origin: org.zkoss.zk/zk

/** Returns the update servlet of the specified application, or
 * null if not loaded yet.
 * Note: if the update servlet is not loaded, it returns null.
 * @since 3.0.2
 */
public static DHtmlUpdateServlet getUpdateServlet(WebApp wapp) {
  return (DHtmlUpdateServlet) (wapp.getServletContext()).getAttribute(ATTR_UPDATE_SERVLET);
}

代码示例来源:origin: org.zkoss.zkforge/ckez

private String getFolderUrl() {
  String uuid = ((String[])param.get("CKEditor"))[0];
  uuid = uuid.substring(0, uuid.lastIndexOf("-cnt"));
  
  String url = null;
  if ("Images".equals(type))
    url = (String) session.getAttribute("filebrowserImageBrowseUrl"+ uuid);
  else if ("Flash".equals(type))
    url = (String) session.getAttribute("filebrowserFlashBrowseUrl"+ uuid);
  
  if (url == null) 
    url = (String) session.getAttribute("filebrowserBrowseUrl"+ uuid);
  
  String updateURI = application.getUpdateURI();
  apName = updateURI.substring(0, updateURI.indexOf("/zkau"));
  int index = url.indexOf(apName);
  if (index == 0 && apName.length() > 0)
    index = url.indexOf("/", 1);
  
  url = index < 0 ? url: url.substring(index);
  
  index = url.lastIndexOf(";jsessionid");
  if (index > 0)
    url = url.substring(0, index);
  
  if (application.getResourcePaths(url) == null)
    throw new UiException("Folder not found: " + url);
  
  return url;
}

代码示例来源:origin: org.zkoss.zk/zk

public void init(Page owner, String zslang) {
  super.init(owner, zslang);
  if (System.getProperty("python.home") == null)
    System.setProperty("python.home", System.getProperty("java.io.tmpdir"));
  PySystemState.initialize();
  PySystemState.add_extdir(owner.getDesktop().getWebApp().getRealPath("/WEB-INF/lib"), true);
  PySystemState.add_classdir(owner.getDesktop().getWebApp().getRealPath("/WEB-INF/classes"));
  _ip = new PythonInterpreter(new Variables());
}

代码示例来源:origin: org.zkoss.zk/zk

/**
 * Loads the content of a file as a String.
 *
 * @since 8.5.1
 */
public static String loadFileContentAsString(Execution exec, String path) throws IOException {
  path = exec.locate(path);
  //ZK-1345: use WebApps.getCurrent() instead of exec.getDesktop().getWebApp()
  InputStream is = WebApps.getCurrent().getResourceAsStream(path);
  if (is == null)
    throw new UiException("Unable to load " + path);
  final byte[] bs = Files.readAll(is);
  Files.close(is);
  return new String(bs, "UTF-8"); //UTF-8 is assumed
}

代码示例来源:origin: org.zkoss.zk/zk

private static String outHost(HttpServletRequest request, WebApp wapp, String clientPackages) {
  final StringBuffer sb = new StringBuffer().append("zk.setHost('").append(request.getScheme()).append("://")
      .append(request.getServerName());
  if (request.getServerPort() != 80)
    sb.append(':').append(request.getServerPort());
  String uri = request.getContextPath();
  if (uri != null && uri.length() > 0) {
    if (uri.charAt(0) != '/')
      sb.append('/');
    sb.append(uri);
    removeLast(sb, '/');
  }
  return sb.append("','").append(wapp.getUpdateURI(false)).append("',").append(clientPackages).append(");")
      .toString();
}

代码示例来源:origin: org.zkoss.zk/zul

/** Open a download dialog to save the resource of the specified path
 * at the client.
 *
 * @param path the path of the resource.
 * It must be retrievable by use of {@link org.zkoss.zk.ui.WebApp#getResource}.
 * @param contentType the content type, e.g., application/pdf.
 * Unlike other save methods, it is optional. If null, the path's
 * extension is used to determine the content type.
 * @exception FileNotFoundException if the resource is not found.
 * @since 3.0.8
 */
public static void save(String path, String contentType) throws FileNotFoundException {
  final URL url = Executions.getCurrent().getDesktop().getWebApp().getResource(path);
  if (url == null)
    throw new FileNotFoundException(path);
  save(url, contentType);
}

代码示例来源:origin: org.zkoss.zk/zk

@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;
        cache.setMaxSize(1024);
        cache.setLifetime(60 * 60000); //1hr
        wapp.setAttribute(ATTR_PAGE_CACHE, cache);

代码示例来源:origin: org.zkoss.zk/zk

/**
 * 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);
}

代码示例来源:origin: org.zkoss.zk/zk

final Map aues = (Map) wapp.getAttribute(ATTR_AU_PROCESSORS);
if (aues != null) {
  for (Iterator it = aues.entrySet().iterator(); it.hasNext();) {
    addAuExtension((String) me.getKey(), (AuExtension) me.getValue());
  wapp.removeAttribute(ATTR_AU_PROCESSORS);

相关文章