Package org.zkoss.util.resource

Examples of org.zkoss.util.resource.ResourceCache$Info


    doGet(request, response);
  }

  private static final String ATTR_PAGE_CACHE = "org.zkoss.web.servlet.dsp.PageCache";
  private final ResourceCache getCache() {
    ResourceCache cache = (ResourceCache)_ctx.getAttribute(ATTR_PAGE_CACHE);
    if (cache == null) {
      synchronized (InterpreterServlet.class) {
        cache = (ResourceCache)_ctx.getAttribute(ATTR_PAGE_CACHE);
        if (cache == null) {
          cache = new ResourceCache(new MyLoader(), 29);
          cache.setMaxSize(1024);
          cache.setLifetime(60*60*1000); //1hr
          _ctx.setAttribute(ATTR_PAGE_CACHE, cache);
        }
      }
    }
    return cache;
View Full Code Here


  //Extendlet//
  public void init(ExtendletConfig config) {
    _webctx = config.getExtendletContext();
    final ZumlLoader loader = new ZumlLoader();
    _cache = new ResourceCache(loader, 17);
    _cache.setMaxSize(512);
    _cache.setLifetime(60*60*1000); //1hr
    final int checkPeriod = loader.getCheckPeriod();
    _cache.setCheckPeriod(checkPeriod >= 0 ? checkPeriod: 60*60*1000); //1hr

View Full Code Here

  ServletContext getServletContext() {
    return _webctx != null ? _webctx.getServletContext(): null;
  }
  void init(ExtendletConfig config, ExtendletLoader loader) {
    _webctx = config.getExtendletContext();
    _cache = new ResourceCache(loader, 16);
    _cache.setMaxSize(1024);
    _cache.setLifetime(60*60*1000); //1hr
    final int checkPeriod = loader.getCheckPeriod();
    _cache.setCheckPeriod(checkPeriod >= 0 ? checkPeriod: 60*60*1000); //1hr
  }
View Full Code Here

  private static ResourceCache _cache;
  private static final ResourceCache getCache() {
    if (_cache == null) {
      synchronized (ZScript.class) {
        if (_cache == null) {
          final ResourceCache cache
            = new ResourceCache(new ContentLoader());
          cache.setMaxSize(512);
          cache.setLifetime(60*60*1000); //1hr
          _cache = cache;
        }
      }
    }
    return _cache;
View Full Code Here

      return new ServletContextLocator((ServletContext)ctx, path);
    throw new UnsupportedOperationException("Unknown context: "+ctx);
  }

  private static final ResourceCache getCache(WebApp wapp) {
    ResourceCache cache = (ResourceCache)wapp.getAttribute(ATTR_PAGE_CACHE);
    if (cache == null) {
      synchronized (PageDefinitions.class) {
        cache = (ResourceCache)wapp.getAttribute(ATTR_PAGE_CACHE);
        if (cache == null) {
          Loader loader = null;
          final String clsnm = Library.getProperty("org.zkoss.zk.ui.metainfo.page.Loader.class");
          if (clsnm != null) {
            try {
              final Object o = Classes.newInstanceByThread(clsnm,
                new Class[] {WebApp.class},
                new Object[] {wapp});
              if (o instanceof Loader)
                loader = (Loader)o;
              else
                log.warning(clsnm + " must implement " + Loader.class.getName());
            } catch (Throwable ex) {
              log.warningBriefly("Unable to instantiate "+clsnm, ex);
            }
          }

          if (loader == null)
            loader = new MyLoader(wapp);
          cache = new ResourceCache(loader, 167);
          cache.setMaxSize(1024);
          cache.setLifetime(60*60000); //1hr
          wapp.setAttribute(ATTR_PAGE_CACHE, cache);
        }
      }
    }
    return cache;
View Full Code Here

  private ResourceCache _cache;

  public void init(ExtendletConfig config) {
    _webctx = config.getExtendletContext();
    final DspLoader loader = new DspLoader();
    _cache = new ResourceCache(loader, 131);
    _cache.setMaxSize(1024);
    _cache.setLifetime(60*60*1000); //1hr
    final int checkPeriod = loader.getCheckPeriod();
    _cache.setCheckPeriod(checkPeriod >= 0 ? checkPeriod: 60*60*1000); //1hr
  }
View Full Code Here

  public static final
  String getContent(ServletContext ctx, String path) {
    return (String)get(getCache(ctx), ctx, path, null);
  }
  private static final ResourceCache getCache(ServletContext ctx) {
    ResourceCache cache = (ResourceCache)ctx.getAttribute(ATTR_PAGE_CACHE);
    if (cache == null) {
      synchronized (ResourceCaches.class) {
        cache = (ResourceCache)ctx.getAttribute(ATTR_PAGE_CACHE);
        if (cache == null) {
          cache = new ResourceCache(new ContentLoader(ctx), 29);
          cache.setMaxSize(1024);
          cache.setLifetime(60*60*1000); //1hr
          ctx.setAttribute(ATTR_PAGE_CACHE, cache);
        }
      }
    }
    return cache;
View Full Code Here

TOP

Related Classes of org.zkoss.util.resource.ResourceCache$Info

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.