Package com.gentics.cr.template

Examples of com.gentics.cr.template.FileTemplate


      this.querytemplate = qt;
    }
    String tmplate = (String) crConf.get("velocitytemplate");
    try {
      File f = new File(tmplate);
      tpl = new FileTemplate(new FileInputStream(f));
    } catch (Exception ex) {
      log.error("FAILED TO LOAD VELOCITY TEMPLATE FROM " + tmplate);
    }
    try {
View Full Code Here


    String templatepath = crConf.getString(VELOCITY_TEMPLATE_KEY);
    if (templatepath != null) {
      File f = new File(templatepath);
      if (f.exists()) {
        try {
          this.tpl = new FileTemplate(new FileInputStream(f));
        } catch (FileNotFoundException e) {
          log.error("Could not load template from " + templatepath, e);
        } catch (CRException e) {
          log.error("Could not load template from " + templatepath, e);
        }
      }
    }
    if (this.tpl == null) {
      String templateName = this.getClass().getSimpleName() + ".vm";
      try {
        InputStream stream = this.getClass().getResourceAsStream(templateName);
        this.tpl = new FileTemplate(stream);
      } catch (Exception e) {
        log.error("failed to load velocity template from " + templateName, e);
      }
    }
  }
View Full Code Here

    }

    FileInputStream inStream = new FileInputStream(file);
    InputStreamReader streamReader = new InputStreamReader(inStream, "UTF-8");
    BufferedReader bufferedReader = new BufferedReader(streamReader);
    return new FileTemplate(bufferedReader);
  }
View Full Code Here

  private FileTemplate getFileTemplate(final String templatePath) throws FileNotFoundException, CRException {
    File file = new File(templatePath);
    if (!file.isAbsolute()) {
      file = new File(CRConfigUtil.DEFAULT_TEMPLATE_PATH + File.separator + templatePath);
    }
    return new FileTemplate(new FileInputStream(file), file);
  }
View Full Code Here

TOP

Related Classes of com.gentics.cr.template.FileTemplate

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.