Package org.eurekaj.scriptcache

Examples of org.eurekaj.scriptcache.ScriptCache


          path = path.substring(0, path.length() - 3);
        }
       
        logger.info("CachedScriptHandler path: " + path);
       
        ScriptCache scriptCache = ScriptHash.getScriptCache(path);
        //if there is no cache at the path, return a 404.
        if (scriptCache == null) {
          sendError(ctx, NOT_FOUND);
          return;
        }
   
        //Set up and send the response.
        writeContentsToBuffer(ctx, scriptCache.getMinifiedScriptContent(), "application/javascript");
  }
View Full Code Here


        //For the Cached Index Handler, we are always serving /index.html with the
        //content type text/html
        String path = "/index.html";
        String contentType = "text/html";
       
        ScriptCache cache = ScriptHash.getScriptCache(path);
        if (cache == null || cache.isExpired()) {
          //If file is not cached, or cache is expired, update the cache.
          logger.info("Updating index.html from filesystem path: " + path);
          cache = updateScriptCacheForPath(path);
        }
       
        String htmlContents = cache.getHtmlContents();
       
        DefaultHttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);;
        response.setHeader(HttpHeaders.Names.CONTENT_TYPE, contentType);

        writeContentsToBuffer(ctx, htmlContents, "text/html");
View Full Code Here

        .attr("type", "text/javascript")
        .attr("charset", "utf-8");
    }
   
    //Create or update the script contents for this HTML file path
    ScriptCache cache = ScriptHash.updateScriptContents(path, scriptPathList, htmlDocument.html(), System.currentTimeMillis() + (maxCacheSeconds * 1000));
    logger.info("Finished extracting script contents took: " + (System.currentTimeMillis() - before) + " ms.");
   
    return cache;
  }
View Full Code Here

TOP

Related Classes of org.eurekaj.scriptcache.ScriptCache

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.