Package com.github.mustachejava

Examples of com.github.mustachejava.MustacheException


      return length == 0 ? null : scopes[length - 1];
    }
    try {
      return binding.get(scopes);
    } catch (Exception e) {
      throw new MustacheException(e.getMessage() + "@" + tc.toString(), e);
    } catch (Error e) {
      throw new MustacheException(e.getMessage() + "@" + tc.toString(), e);
    }
  }
View Full Code Here


          tag(writer, "/");
        }
      }
      appendText(writer);
    } catch (IOException e) {
      throw new MustacheException(e);
    }
  }
View Full Code Here

  protected Writer appendText(Writer writer) {
    if (appended != null) {
      try {
        writer.write(appended);
      } catch (IOException e) {
        throw new MustacheException(e);
      }
    }
    return writer;
  }
View Full Code Here

    @Override
    public Reader getReader(String resourceName) {
        final InputStream is = klass.getResourceAsStream(resourceName);
        if (is == null) {
            throw new MustacheException("Template " + resourceName + " not found");
        }
        return new BufferedReader(new InputStreamReader(is, Charsets.UTF_8));
    }
View Full Code Here

    Preconditions.checkNotNull(parameters);

    try {
      InputStream stream = getClass().getResourceAsStream(templateName);
      if (stream == null) {
        throw new MustacheException("Template not found: " + templateName);
      }
      Mustache mustache = mf.compile(new InputStreamReader(stream), templateName);
      mustache.execute(response.getWriter(), parameters);

      response.setStatus(status);
View Full Code Here

    @Override
    public void encode(String value, Writer writer) {
        try {
            escape(value, writer);
        } catch (IOException e) {
            throw new MustacheException("Failed to encode value: " + value);
        }
    }
View Full Code Here

        Resource resource = resourceLoader.getResource(resourceName);
        if (resource.exists()) {
            try {
                return new InputStreamReader(resource.getInputStream(), encoding);
            } catch (IOException e) {
                throw new MustacheException("Failed to load template: " + resourceName, e);
            }
        }
        throw new MustacheException("No template exists named: " + resourceName);
    }
View Full Code Here

TOP

Related Classes of com.github.mustachejava.MustacheException

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.