コード例 #1
0
  private GroovyPageTemplate createTemplateFromPrecompiled(String originalUri, String uri) {
    if (precompiledGspMap != null) {
      GroovyPageMetaInfo meta = precompiledCache.get(uri);
      if (meta != null) {
        return new GroovyPageTemplate(meta);
      }
      String gspClassName = precompiledGspMap.get(uri);
      if (gspClassName != null) {
        Class<GroovyPage> gspClass = null;
        try {
          gspClass =
              (Class<GroovyPage>)
                  Class.forName(gspClassName, true, Thread.currentThread().getContextClassLoader());
        } catch (ClassNotFoundException e) {
          LOG.warn(
              "Cannot load class " + gspClassName + ". Resuming on non-precompiled implementation.",
              e);
        }
        if (gspClass != null) {
          meta = new GroovyPageMetaInfo(gspClass);
          meta.setJspTagLibraryResolver(jspTagLibraryResolver);
          meta.setTagLibraryLookup(tagLibraryLookup);
          if (LOG.isDebugEnabled()) {
            LOG.debug(
                "Adding GSP class GroovyPageMetaInfo in cache for uri "
                    + uri
                    + " classname is "
                    + gspClassName);
          }
          precompiledCache.put(uri, meta);
          precompiledCache.put(originalUri, meta);
          return new GroovyPageTemplate(meta);
        }
      }
      if (precompiledGspMap.size() > 0) {}

      if (LOG.isDebugEnabled()) {
        LOG.debug("No precompiled template found for uri '" + uri + "'");
      }
    }
    return null;
  }
コード例 #2
0
 public void afterPropertiesSet() {
   if (classLoader == null) {
     this.classLoader = initGroovyClassLoader(Thread.currentThread().getContextClassLoader());
   }
 }