public static synchronized File getProcessedFile(
      String resourceName, InputStream resourceInputStream) throws IOException {
    resourceName = resourceName.replace(".css", "_processed.css");
    resourceName = resourceName.substring(resourceName.lastIndexOf("/") + 1);
    File file =
        new File(
            CommonWorkingDirectory.PROCESSED_RESOURCES_DIR.getDirectoryPath(true) + resourceName);
    if (!file.exists() || ApplicationUtil.getAplosContextListener().isDebugMode()) {
      String lineSep = System.getProperty("line.separator");
      BufferedReader br = null;
      br = new BufferedReader(new InputStreamReader(resourceInputStream));

      String nextLine = "";
      StringBuffer sb = new StringBuffer();
      try {
        while ((nextLine = br.readLine()) != null) {
          sb.append(nextLine);
          sb.append(lineSep);
        }
      } catch (IOException e1) {
        e1.printStackTrace();
      }
      String cssContent = sb.toString();
      String newCssContent =
          CommonUtil.includeContextRootInPathsForCss(cssContent, JSFUtil.getContextPath());
      FileOutputStream fileOutputStream = new FileOutputStream(file);
      fileOutputStream.write(newCssContent.getBytes());
      fileOutputStream.close();
    }
    return file;
  }
 public String generateXhtml(String contextRoot) {
   String contextRootWithoutSlash = contextRoot.replace("\\", "").replace("/", "");
   StringBuffer strBuf = new StringBuffer();
   // for ease of debugging
   String descriptionString = "";
   if (this.getDescription() != null && !this.getDescription().equals("")) {
     descriptionString = " (" + this.getDescription() + ")";
   }
   strBuf.append("// File: " + this.getName() + descriptionString + "\n");
   strBuf.append(
       "// Last Generated: "
           + FormatUtil.formatDate(FormatUtil.getEngSlashSimpleDateTimeFormat(), new Date())
           + "\n");
   strBuf.append(
       CommonUtil.includeContextRootInPathsForCss(getContent(), contextRootWithoutSlash));
   return strBuf.toString();
 }