/** * Apply velocity to the input. */ private String filterVelocity(TemplateFile f, String template, TemplateOptions options) { final VelocityContext ctx = new VelocityContext(); ctx.put("TemplateOptions", options); ctx.put("true", true); ctx.put("templateOnly", false); ctx.put("false", false); StringWriter sw = new StringWriter(); velocity.evaluate(ctx, sw, f.getFileName(), template); return sw.toString(); }
/** * Renders the input reader using the context into the output writer. * To be used when a template is dynamically constructed, or want to * use Velocity as a token replacer. * * @param context context to use in rendering input string * @param writer Writer in which to render the output * @param logTag string to be used as the template name for log messages * in case of error * @param reader Reader containing the VTL to be rendered * * @return true if successful, false otherwise. If false, see * Velocity runtime log * @throws ParseErrorException The template could not be parsed. * @throws MethodInvocationException A method on a context object could not be invoked. * @throws ResourceNotFoundException A referenced resource could not be loaded. * @throws IOException While reading from the reader or rendering to the writer, * an I/O problem occured. * @since Velocity v1.1 */ public boolean evaluate(Context context, Writer writer, String logTag, Reader reader) throws ParseErrorException, MethodInvocationException, ResourceNotFoundException,IOException { return ri.evaluate(context, writer, logTag, reader); }
/** * renders the input string using the context into the output writer. * To be used when a template is dynamically constructed, or want to use * Velocity as a token replacer. * * @param context context to use in rendering input string * @param out Writer in which to render the output * @param logTag string to be used as the template name for log * messages in case of error * @param instring input string containing the VTL to be rendered * * @return true if successful, false otherwise. If false, see * Velocity runtime log * @throws ParseErrorException The template could not be parsed. * @throws MethodInvocationException A method on a context object could not be invoked. * @throws ResourceNotFoundException A referenced resource could not be loaded. */ public boolean evaluate( Context context, Writer out, String logTag, String instring ) throws ParseErrorException, MethodInvocationException, ResourceNotFoundException { return ri.evaluate(context, out, logTag, instring); }
/** * Renders the input reader using the context into the output writer. * To be used when a template is dynamically constructed, or want to * use Velocity as a token replacer. * * @param context context to use in rendering input string * @param writer Writer in which to render the output * @param logTag string to be used as the template name for log messages * in case of error * @param reader Reader containing the VTL to be rendered * * @return true if successful, false otherwise. If false, see * Velocity runtime log * @throws ParseErrorException The template could not be parsed. * @throws MethodInvocationException A method on a context object could not be invoked. * @throws ResourceNotFoundException A referenced resource could not be loaded. * @since Velocity v1.1 */ public boolean evaluate(Context context, Writer writer, String logTag, Reader reader) throws ParseErrorException, MethodInvocationException, ResourceNotFoundException { return ri.evaluate(context, writer, logTag, reader); }
/** * renders the input string using the context into the output writer. * To be used when a template is dynamically constructed, or want to use * Velocity as a token replacer. * * @param context context to use in rendering input string * @param out Writer in which to render the output * @param logTag string to be used as the template name for log * messages in case of error * @param instring input string containing the VTL to be rendered * * @return true if successful, false otherwise. If false, see * Velocity runtime log * @throws ParseErrorException The template could not be parsed. * @throws MethodInvocationException A method on a context object could not be invoked. * @throws ResourceNotFoundException A referenced resource could not be loaded. */ public boolean evaluate( Context context, Writer out, String logTag, String instring ) throws ParseErrorException, MethodInvocationException, ResourceNotFoundException { return ri.evaluate(context, out, logTag, instring); }
/** * Renders the input reader using the context into the output writer. * To be used when a template is dynamically constructed, or want to * use Velocity as a token replacer. * * @param context context to use in rendering input string * @param writer Writer in which to render the output * @param logTag string to be used as the template name for log messages * in case of error * @param reader Reader containing the VTL to be rendered * * @return true if successful, false otherwise. If false, see * Velocity runtime log * @throws ParseErrorException The template could not be parsed. * @throws MethodInvocationException A method on a context object could not be invoked. * @throws ResourceNotFoundException A referenced resource could not be loaded. * @since Velocity v1.1 */ public boolean evaluate(Context context, Writer writer, String logTag, Reader reader) throws ParseErrorException, MethodInvocationException, ResourceNotFoundException { return ri.evaluate(context, writer, logTag, reader); }
/** * renders the input string using the context into the output writer. * To be used when a template is dynamically constructed, or want to use * Velocity as a token replacer. * * @param context context to use in rendering input string * @param out Writer in which to render the output * @param logTag string to be used as the template name for log * messages in case of error * @param instring input string containing the VTL to be rendered * * @return true if successful, false otherwise. If false, see * Velocity runtime log * @throws ParseErrorException The template could not be parsed. * @throws MethodInvocationException A method on a context object could not be invoked. * @throws ResourceNotFoundException A referenced resource could not be loaded. * @throws IOException While rendering to the writer, an I/O problem occured. */ public boolean evaluate( Context context, Writer out, String logTag, String instring ) throws ParseErrorException, MethodInvocationException, ResourceNotFoundException, IOException { return ri.evaluate(context, out, logTag, instring); }
/** * Renders the input string using the context into the output writer. * To be used when a template is dynamically constructed, or want to use * Velocity as a token replacer. * * @param context context to use in rendering input string * @param out Writer in which to render the output * @param logTag string to be used as the template name for log * messages in case of error * @param instring input string containing the VTL to be rendered * * @return true if successful, false otherwise. If false, see * Velocity runtime log * @throws ParseErrorException The template could not be parsed. * @throws MethodInvocationException A method on a context object could not be invoked. * @throws ResourceNotFoundException A referenced resource could not be loaded. * @since Velocity 1.6 */ public boolean evaluate(Context context, Writer out, String logTag, String instring) { return evaluate(context, out, logTag, new StringReader(instring)); }
/** * Renders the input string using the context into the output writer. * To be used when a template is dynamically constructed, or want to use * Velocity as a token replacer. * * @param context context to use in rendering input string * @param out Writer in which to render the output * @param logTag string to be used as the template name for log * messages in case of error * @param instring input string containing the VTL to be rendered * * @return true if successful, false otherwise. If false, see * Velocity runtime log * @throws ParseErrorException The template could not be parsed. * @throws MethodInvocationException A method on a context object could not be invoked. * @throws ResourceNotFoundException A referenced resource could not be loaded. * @throws IOException While rendering to the writer, an I/O problem occured. * @since Velocity 1.6 */ public boolean evaluate(Context context, Writer out, String logTag, String instring) throws IOException { return evaluate(context, out, logTag, new StringReader(instring)); }
/** * Renders the input string using the context into the output writer. * To be used when a template is dynamically constructed, or want to use * Velocity as a token replacer. * <br> * Note! Macros defined in evaluate() calls are not persisted in memory so next evaluate() call * does not know about macros defined during previous calls. * * @param context context to use in rendering input string * @param out Writer in which to render the output * @param logTag string to be used as the template name for log * messages in case of error * @param instring input string containing the VTL to be rendered * * @return true if successful, false otherwise. If false, see * Velocity runtime log * @throws ParseErrorException The template could not be parsed. * @throws MethodInvocationException A method on a context object could not be invoked. * @throws ResourceNotFoundException A referenced resource could not be loaded. * @since Velocity 1.6 */ public boolean evaluate(Context context, Writer out, String logTag, String instring) { return evaluate(context, out, logTag, new StringReader(instring)); }
/** * Apply velocity to the input. */ private String filterVelocity(TemplateFile f, String template, TemplateOptions options) { final VelocityContext ctx = new VelocityContext(); ctx.put("TemplateOptions", options); ctx.put("true", true); ctx.put("templateOnly", false); ctx.put("false", false); StringWriter sw = new StringWriter(); velocity.evaluate(ctx, sw, f.getFileName(), template); return sw.toString(); }
return evaluate(context, writer, logTag, template.toString());
velocityEngine.evaluate(vctx, out, fileName, reader); out.flush();
return evaluate(context, writer, logTag, template.toString());
return evaluate(context, writer, logTag, template.toString());