Package com.lbslocal.api.scriptcompact

Examples of com.lbslocal.api.scriptcompact.ControlJavaScriptAPI


        + File.separator + "lbslocal" + File.separator + "api" + File.separator + "scripts";

    ConfigurationManager cm = ConfigurationManager.getInstance();
    com.lbslocal.master.common.ConfigurationManager cmMaster = com.lbslocal.master.common.ConfigurationManager.getInstance();

    ControlJavaScriptAPI memoryAPI = new ControlJavaScriptAPI(physicalPath, cmMaster.getAppSettings("PATH_FILE_API"));

    String AcceptEncoding, versionApi, engine, api, debug;
    boolean useGZip = true;

    engine = request.getParameter("engine") == null ? "" : request.getParameter("engine");
    versionApi = request.getParameter("v") == null ? "3" : request.getParameter("v");
    debug = request.getParameter("debug") == null ? "" : request.getParameter("debug");
    ServletOutputStream out = null;
    File file;
    RandomAccessFile raf = null;
    try {
      response.setContentType("application/x-javascript");

      AcceptEncoding = request.getHeader("Accept-Encoding");

      // *** Start by checking whether GZip is supported by client
      if (AcceptEncoding == null || AcceptEncoding.toLowerCase().indexOf("gzip") == -1)
        useGZip = false;

      api = "v" + versionApi + engine.toLowerCase();
     

      // é uma chamada de debug?
      if ("true".equals(cm.getAppSettings("debugJS")) || debug.equals("true")) {
        response.setHeader("Content-Encoding", "UTF-8");
        file = memoryAPI.getAPI(api, ControlJavaScriptAPI.Debug);
      } else {
        // é possivel usar o gzip?
        if (useGZip) {
          response.setHeader("Content-Encoding", "gzip");
          file = memoryAPI.getAPI(api, ControlJavaScriptAPI.GZip);
        } else {
          response.setHeader("Content-Encoding", "UTF-8");
          file = memoryAPI.getAPI(api, ControlJavaScriptAPI.Flat);
        }
      }
      raf = new RandomAccessFile(file, "r");
      response.setContentLength((int) raf.length());
      out = response.getOutputStream();
View Full Code Here

TOP

Related Classes of com.lbslocal.api.scriptcompact.ControlJavaScriptAPI

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.