Java Code Examples for org.apache.velocity.runtime.RuntimeServices#getLog()
The following examples show how to use
org.apache.velocity.runtime.RuntimeServices#getLog() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleNode.java From velocity-engine with Apache License 2.0 | 6 votes |
/** * @throws TemplateInitException * @see org.apache.velocity.runtime.parser.node.Node#init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object) */ public Object init( InternalContextAdapter context, Object data) throws TemplateInitException { /* * hold onto the RuntimeServices */ rsvc = (RuntimeServices) data; log = rsvc.getLog("rendering"); int i, k = jjtGetNumChildren(); for (i = 0; i < k; i++) { jjtGetChild(i).init( context, data); } line = first.beginLine; column = first.beginColumn; return data; }
Example 2
Source File: VelocimacroProxy.java From velocity-engine with Apache License 2.0 | 6 votes |
/** * Initialize members of VelocimacroProxy. called from MacroEntry * @param rs runtime services */ public void init(RuntimeServices rs) { rsvc = rs; log = rs.getLog("macro"); strictArguments = rsvc.getBoolean( RuntimeConstants.VM_ARGUMENTS_STRICT, false); // get the macro call depth limit maxCallDepth = rsvc.getInt(RuntimeConstants.VM_MAX_DEPTH); // get name of the reference that refers to AST block passed to block macro call bodyReference = rsvc.getString(RuntimeConstants.VM_BODY_REFERENCE, "bodyContent"); enableBCmode = rsvc.getBoolean(RuntimeConstants.VM_ENABLE_BC_MODE, false); }
Example 3
Source File: JavaScriptCompressorDirective.java From htmlcompressor with Apache License 2.0 | 5 votes |
@Override public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException { super.init(rs, context, node); log = rs.getLog(); //set compressor properties enabled = rs.getBoolean("userdirective.compressJs.enabled", true); jsCompressor = rs.getString("userdirective.compressHtml.jsCompressor", HtmlCompressor.JS_COMPRESSOR_YUI); yuiJsNoMunge = rs.getBoolean("userdirective.compressJs.yuiJsNoMunge", false); yuiJsPreserveAllSemiColons = rs.getBoolean("userdirective.compressJs.yuiJsPreserveAllSemiColons", false); yuiJsLineBreak = rs.getInt("userdirective.compressJs.yuiJsLineBreak", -1); closureOptLevel = rs.getString("userdirective.compressHtml.closureOptLevel", ClosureJavaScriptCompressor.COMPILATION_LEVEL_SIMPLE); }
Example 4
Source File: CssCompressorDirective.java From htmlcompressor with Apache License 2.0 | 5 votes |
@Override public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException { super.init(rs, context, node); log = rs.getLog(); //set compressor properties enabled = rs.getBoolean("userdirective.compressCss.enabled", true); yuiCssLineBreak = rs.getInt("userdirective.compressCss.yuiCssLineBreak", -1); }
Example 5
Source File: XmlCompressorDirective.java From htmlcompressor with Apache License 2.0 | 5 votes |
@Override public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException { super.init(rs, context, node); log = rs.getLog(); //set compressor properties xmlCompressor.setEnabled(rs.getBoolean("userdirective.compressXml.enabled", true)); xmlCompressor.setRemoveComments(rs.getBoolean("userdirective.compressXml.removeComments", true)); xmlCompressor.setRemoveIntertagSpaces(rs.getBoolean("userdirective.compressXml.removeIntertagSpaces", true)); }
Example 6
Source File: EscapeReference.java From velocity-engine with Apache License 2.0 | 5 votes |
/** * Called automatically when event cartridge is initialized. * * @param rs instance of RuntimeServices */ public void setRuntimeServices(RuntimeServices rs) { this.rs = rs; log = rs.getLog("event"); // Get the regular expression pattern. matchRegExp = StringUtils.trim(rs.getString(getMatchAttribute())); if (org.apache.commons.lang3.StringUtils.isEmpty(matchRegExp)) { matchRegExp = null; } // Test the regular expression for a well formed pattern if (matchRegExp != null) { try { "".matches(matchRegExp); } catch (PatternSyntaxException E) { log.error("Invalid regular expression '{}'. No escaping will be performed.", matchRegExp, E); matchRegExp = null; } } }
Example 7
Source File: IncludeNotFound.java From velocity-engine with Apache License 2.0 | 5 votes |
/** * @see org.apache.velocity.util.RuntimeServicesAware#setRuntimeServices(org.apache.velocity.runtime.RuntimeServices) */ public void setRuntimeServices(RuntimeServices rs) { this.rs = rs; log = rs.getLog("event"); notfound = StringUtils.trim(rs.getString(PROPERTY_NOT_FOUND, DEFAULT_NOT_FOUND)); }
Example 8
Source File: HtmlCompressorDirective.java From htmlcompressor with Apache License 2.0 | 4 votes |
@Override public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException { super.init(rs, context, node); log = rs.getLog(); boolean compressJavaScript = rs.getBoolean("userdirective.compressHtml.compressJavaScript", false); //set compressor properties htmlCompressor.setEnabled(rs.getBoolean("userdirective.compressHtml.enabled", true)); htmlCompressor.setRemoveComments(rs.getBoolean("userdirective.compressHtml.removeComments", true)); htmlCompressor.setRemoveMultiSpaces(rs.getBoolean("userdirective.compressHtml.removeMultiSpaces", true)); htmlCompressor.setRemoveIntertagSpaces(rs.getBoolean("userdirective.compressHtml.removeIntertagSpaces", false)); htmlCompressor.setRemoveQuotes(rs.getBoolean("userdirective.compressHtml.removeQuotes", false)); htmlCompressor.setPreserveLineBreaks(rs.getBoolean("userdirective.compressHtml.preserveLineBreaks", false)); htmlCompressor.setCompressJavaScript(compressJavaScript); htmlCompressor.setCompressCss(rs.getBoolean("userdirective.compressHtml.compressCss", false)); htmlCompressor.setYuiJsNoMunge(rs.getBoolean("userdirective.compressHtml.yuiJsNoMunge", false)); htmlCompressor.setYuiJsPreserveAllSemiColons(rs.getBoolean("userdirective.compressHtml.yuiJsPreserveAllSemiColons", false)); htmlCompressor.setYuiJsLineBreak(rs.getInt("userdirective.compressHtml.yuiJsLineBreak", -1)); htmlCompressor.setYuiCssLineBreak(rs.getInt("userdirective.compressHtml.yuiCssLineBreak", -1)); htmlCompressor.setSimpleDoctype(rs.getBoolean("userdirective.compressHtml.simpleDoctype", false)); htmlCompressor.setRemoveScriptAttributes(rs.getBoolean("userdirective.compressHtml.removeScriptAttributes", false)); htmlCompressor.setRemoveStyleAttributes(rs.getBoolean("userdirective.compressHtml.removeStyleAttributes", false)); htmlCompressor.setRemoveLinkAttributes(rs.getBoolean("userdirective.compressHtml.removeLinkAttributes", false)); htmlCompressor.setRemoveFormAttributes(rs.getBoolean("userdirective.compressHtml.removeFormAttributes", false)); htmlCompressor.setRemoveInputAttributes(rs.getBoolean("userdirective.compressHtml.removeInputAttributes", false)); htmlCompressor.setSimpleBooleanAttributes(rs.getBoolean("userdirective.compressHtml.simpleBooleanAttributes", false)); htmlCompressor.setRemoveJavaScriptProtocol(rs.getBoolean("userdirective.compressHtml.removeJavaScriptProtocol", false)); htmlCompressor.setRemoveHttpProtocol(rs.getBoolean("userdirective.compressHtml.removeHttpProtocol", false)); htmlCompressor.setRemoveHttpsProtocol(rs.getBoolean("userdirective.compressHtml.removeHttpsProtocol", false)); if(compressJavaScript && rs.getString("userdirective.compressHtml.jsCompressor", HtmlCompressor.JS_COMPRESSOR_YUI).equalsIgnoreCase(HtmlCompressor.JS_COMPRESSOR_CLOSURE)) { String closureOptLevel = rs.getString("userdirective.compressHtml.closureOptLevel", ClosureJavaScriptCompressor.COMPILATION_LEVEL_SIMPLE); ClosureJavaScriptCompressor closureCompressor = new ClosureJavaScriptCompressor(); if(closureOptLevel.equalsIgnoreCase(ClosureJavaScriptCompressor.COMPILATION_LEVEL_ADVANCED)) { closureCompressor.setCompilationLevel(CompilationLevel.ADVANCED_OPTIMIZATIONS); } else if(closureOptLevel.equalsIgnoreCase(ClosureJavaScriptCompressor.COMPILATION_LEVEL_WHITESPACE)) { closureCompressor.setCompilationLevel(CompilationLevel.WHITESPACE_ONLY); } else { closureCompressor.setCompilationLevel(CompilationLevel.SIMPLE_OPTIMIZATIONS); } htmlCompressor.setJavaScriptCompressor(closureCompressor); } }
Example 9
Source File: UberspectPublicFields.java From velocity-engine with Apache License 2.0 | 4 votes |
/** * @param rs RuntimeServices object assigned during initialization */ public void setRuntimeServices(RuntimeServices rs) { log = rs.getLog("rendering"); }