Package org.apache.velocity.app

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


    FileWriter writer = new FileWriter(fileHTML);
    VelocityEngine ve = new VelocityEngine();
    /* disable logging */
    ve.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS,
            "org.apache.velocity.runtime.log.NullLogChute");
    ve.evaluate(context, writer, "index", template);
    writer.flush();
    writer.close();
  }

  private void writeHtmlForState(StateVertix state, List<RenderedCandidateElement> rendered)
View Full Code Here


    FileWriter writer = new FileWriter(fileHTML);
    VelocityEngine ve = new VelocityEngine();
    /* disable logging */
    ve.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS,
            "org.apache.velocity.runtime.log.NullLogChute");
    ve.evaluate(context, writer, state.getName(), template);
    writer.flush();
    writer.close();
  }

  private void findElementAndAddToMap(StateVertix state, CandidateElement element) {
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

        // 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());
      
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());
        out.setHeaders(exchange.getIn().getHeaders());
View Full Code Here

        }

        // let velocity parse and generate the result in buffer
        VelocityEngine engine = getVelocityEngine();
        log.debug("Velocity is evaluating using velocity context: {}", velocityContext);
        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

        Writer writer = new StringWriter();

        try
        {
            ve.evaluate(context,writer,"testMacroInvoke", "#macro(   foo $a) $a #end #foo(woogie)");
            fail("Should have thown a ParseErrorException");
        }
        catch (org.apache.velocity.exception.TemplateInitException e)
        {
            assertEquals("testMacroInvoke",e.getTemplateName());
View Full Code Here

       
        Writer writer = new StringWriter();
       
        try
        {
            ve.evaluate(context,writer,"testMacroInvoke", "#macro(foo $a) $a #end #foo('test1' 'test2')");    
            fail("Should have thown a ParseErrorException");
        }
        catch (ParseErrorException e)
        {
            assertEquals("testMacroInvoke",e.getTemplateName());
View Full Code Here

        Writer writer = new StringWriter();

        // will not throw an exception
        try
        {
            ve.evaluate(context,writer,"testMacroInvoke", "#macro(foo $a) $a #end #foo('test1' 'test2')");    
        }
        finally
        {
            if (writer != null)
            {
View Full Code Here

        context.put("a1","test");
        context.put("b1","test");
        Writer writer = new StringWriter();

        ve.evaluate(context,writer,"test","$a1 $c1 $a1.length() $a1.foobar()");

        List errors = reporter.getInvalidReferences();
        assertEquals(2,errors.size());
        assertEquals("$c1",((InvalidReferenceInfo) errors.get(0)).getInvalidReference());
        assertEquals("$a1.foobar()",((InvalidReferenceInfo) errors.get(1)).getInvalidReference());
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.