@Override
  public int execute(ModuleRequest request, ModuleResponse response, ServletContext context) {
    this.context = context;
    String url = getURL(request);

    LOGGER.trace("Started processing request : {}", url);

    List<String> resourcesToMerge = Utils.findResourcesToMerge(request.getContextPath(), url);

    // If not modified, return 304 and stop
    ResourceStatus status = isNotModified(request, response, resourcesToMerge);
    if (status.isNotModified()) {
      LOGGER.debug("Resources Not Modified. Sending 304.");
      sendNotModified(response);
      return STOP_CHAIN;
    }

    String extensionOrPath = Utils.detectExtension(url); // in case of non js/css files it null
    if (extensionOrPath == null) {
      extensionOrPath =
          resourcesToMerge.get(
              0); // non grouped i.e. non css/js file, we refer it's path in that case
    }

    // Add appropriate headers
    addAppropriateResponseHeaders(
        extensionOrPath, resourcesToMerge, status.getActualETag(), response);
    try {
      OutputStream outputStream = response.getOutputStream();
      int resourcesNotFound =
          processResources(
              request.getContextPath(), outputStream, resourcesToMerge, autoCorrectUrlsInCss);

      if (resourcesNotFound > 0
          && resourcesNotFound == resourcesToMerge.size()) { // all resources not found
        response.sendError(HttpServletResponse.SC_NOT_FOUND);
        LOGGER.warn("All resources are not found. Sending 404.");
        return STOP_CHAIN;
      }

      if (outputStream != null) {
        // try {
        response.setStatus(HttpServletResponse.SC_OK);
        outputStream.close();
        // response.commit();
        // } catch (IOException e) {
        // e.printStackTrace();
        //  LOGGER.error(Utils.buildLoggerMessage("Response commit failed.", e.getMessage()));
        // return IRule.Status.CONTINUE;
        // }
      }
    } catch (IOException ex) {
      // ex.printStackTrace();
      LOGGER.error("Error in processing request.", ex);
      return OK;
    }

    LOGGER.debug("Finished processing Request : {}", url);
    return STOP_CHAIN;
  }
 @Override
 public int execute(ModuleRequest request, ModuleResponse response, ServletContext context) {
   request.setAttribute("rule", this);
   return OK;
 }