Package org.apache.velocity.app

Examples of org.apache.velocity.app.VelocityEngine.evaluate()


       
        // no arguments
        StringWriter writer = new StringWriter();
        try
        {
            ve.evaluate(context, writer, "test",
                              "#evaluate()");
            fail("Expected exception");
        }
        catch (ParseErrorException e)
        {
View Full Code Here


       
        // too many arguments
        writer = new StringWriter();
        try
        {
            ve.evaluate(context, writer, "test",
                              "#evaluate('aaa' 'bbb')");
            fail("Expected exception");
        }
        catch (ParseErrorException e)
        {
View Full Code Here

       
        // argument not a string or reference
        writer = new StringWriter();
        try
        {
            ve.evaluate(context, writer, "test",
                              "#evaluate(10)");
            fail("Expected exception");
        }
        catch (ParseErrorException e)
        {
View Full Code Here

        writer = new StringWriter();
        try
        {
            String eval = "this is a multiline\n\n\n\n\n test #foreach() with an error";
            context.put("eval",eval);
            ve.evaluate(context, writer, "test",
                              "first line\n second line: #evaluate($eval)");
            fail("Expected exception");
        }
        catch (ParseErrorException e)
        {
View Full Code Here

        Context velocityContext = new VelocityContext(variableMap);

        // let velocity parse and generate the result in buffer
        VelocityEngine engine = getVelocityEngine();
        log.debug("Velocity is evaluating using velocity context: {}", variableMap);
        engine.evaluate(velocityContext, buffer, logTag, reader);

        // now lets output the results to the exchange
        Message out = exchange.getOut();
        out.setBody(buffer.toString());
View Full Code Here

    context.put("regexpTokens", regexpTokens);
    context.put("StringUtil", StringUtil.class);
    context.put("maxTokenLength", maxLen[0]);

    StringWriter out = new StringWriter();
    ve.evaluate(context, out, "lexer.flex.template", new InputStreamReader(getClass().getResourceAsStream("/templates/lexer.flex.template")));
    return StringUtil.convertLineSeparators(out.toString());
  }

  @NotNull
  public static String token2JFlex(@NotNull String tokenText) {
View Full Code Here

    InputStream in = this.getClass().getClassLoader().getResourceAsStream(templatePath);
   
    VelocityEngine templateEngine = new VelocityEngine();
    templateEngine.init();
   
    templateEngine.evaluate(context, writer, "rdf-reconcile-extension", new InputStreamReader(in));
    writer.close();
    String html = writer.toString();
    return html;
  }
 
View Full Code Here

    InputStream in = this.getClass().getClassLoader().getResourceAsStream(templatePath);
   
    VelocityEngine templateEngine = new VelocityEngine();
    templateEngine.init();
   
    templateEngine.evaluate(context, writer, "rdf-reconcile-extension", new InputStreamReader(in));
    writer.close();
    String html = writer.toString();
    return html;
  }
View Full Code Here

    InputStream in = this.getClass().getClassLoader().getResourceAsStream(templatePath);
   
    VelocityEngine templateEngine = new VelocityEngine();
    templateEngine.init();
   
    templateEngine.evaluate(context, writer, "rdf-reconcile-extension", new InputStreamReader(in));
    writer.close();
    String html = writer.toString();
    return html;
  }
 
View Full Code Here

        // let velocity parse and generate the result in buffer
        VelocityEngine engine = getVelocityEngine();
        if (log.isDebugEnabled()) {
            log.debug("Velocity is evaluating using velocity context: " + variableMap);
        }
        engine.evaluate(velocityContext, buffer, logTag, reader);

        // now lets output the results to the exchange
        Message out = exchange.getOut();
        out.setBody(buffer.toString());
        out.setHeaders(exchange.getIn().getHeaders());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.