Java源码示例:org.apache.velocity.exception.TemplateInitException

示例1
/**
 *  simple init - init our subtree and get what we can from
 *  the AST
 * @param context
 * @param data
 * @return The init result
 * @throws TemplateInitException
 */
public Object init(  InternalContextAdapter context, Object data)
    throws TemplateInitException
{
    super.init(  context, data );

    /*
     * make an uberinfo - saves new's later on
     */

    uberInfo = new Info(getTemplateName(),
            getLine(),getColumn());
    /*
     *  this is about all we can do
     */

    methodName = getFirstToken().image;
    paramCount = jjtGetNumChildren() - 1;

    strictRef = rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false);
    logOnInvalid = rsvc.getBoolean(RuntimeConstants.RUNTIME_LOG_METHOD_CALL_LOG_INVALID, true);

    cleanupParserAndTokens();

    return data;
}
 
示例2
/**
 * @see org.apache.velocity.runtime.parser.node.SimpleNode#init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)
 */
public Object init( InternalContextAdapter context, Object data)
throws TemplateInitException
{
    StringBuilder builder = new StringBuilder();
    Token t = getFirstToken();
    for (; t != getLastToken(); t = t.next)
    {
        builder.append(NodeUtils.tokenLiteral(parser, t));
    }
    builder.append(NodeUtils.tokenLiteral(parser, t));
    ctext = builder.toString();

    cleanupParserAndTokens();

    return data;
}
 
示例3
/**
 * @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;
}
 
示例4
/**
 *  simple init - don't do anything that is context specific.
 *  just get what we need from the AST, which is static.
 * @param context
 * @param data
 * @return The data object.
 * @throws TemplateInitException
 */
public  Object init(InternalContextAdapter context, Object data)
    throws TemplateInitException
{
    super.init(context, data);

    identifier = rsvc.useStringInterning() ? getFirstToken().image.intern() : getFirstToken().image;

    uberInfo = new Info(getTemplateName(), getLine(), getColumn());

    strictRef = rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false);

    saveTokenImages();
    cleanupParserAndTokens();

    return data;
}
 
示例5
/**
 * @see org.apache.velocity.runtime.parser.node.SimpleNode#init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)
 */
public Object init( InternalContextAdapter context, Object data)
throws TemplateInitException
{
    Token t = getFirstToken();

    String text = t.image;

    // t.image is in format: #[[ <string> ]]#
    // we must strip away the hash tags
    text = text.substring(START.length(), text.length() - END.length());

    ctext = text.toCharArray();

    cleanupParserAndTokens();

    return data;
}
 
示例6
/**
 * Initializes the directive.
 *
 * @param rs
 * @param macroName
 * @param context
 * @param node
 * @throws TemplateInitException
 */
public void init(RuntimeServices rs, String macroName, InternalContextAdapter context, Node node)
    throws TemplateInitException
{
    this.name = macroName;

    super.init(rs, context, node);

    // get name of the reference that refers to AST block passed to block macro call
    key = rsvc.getString(RuntimeConstants.VM_BODY_REFERENCE, "bodyContent");

    // use the macro max depth for bodyContent max depth as well
    maxDepth = rsvc.getInt(RuntimeConstants.VM_MAX_DEPTH);

    macro = new RuntimeMacro();
    macro.setLocation(getLine(), getColumn(), getTemplate());
    macro.init(rsvc, name, context, node);
}
 
示例7
/**
 *  simple init - init the tree and get the elementKey from
 *  the AST
 * @param rs
 * @param context
 * @param node
 * @throws TemplateInitException
 */
public void init(RuntimeServices rs, InternalContextAdapter context,
                 Node node)
    throws TemplateInitException
{
    super.init( rs, context, node );

    /*
     *  get the msg, and add the space so we don't have to
     *  do it each time
     */
    outputMsgStart = rsvc.getString(RuntimeConstants.ERRORMSG_START);
    outputMsgStart = outputMsgStart + " ";

    outputMsgEnd = rsvc.getString(RuntimeConstants.ERRORMSG_END );
    outputMsgEnd = " " + outputMsgEnd;
}
 
示例8
@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);
}
 
示例9
@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);
}
 
示例10
@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));
}
 
示例11
/**
 * @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
{
    Object obj = super.init(context, data);
    cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
    return obj;
}
 
示例12
/**
 * @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
{
	Object obj = super.init(context, data);
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例13
/**
 * @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
{
    Object obj = super.init(context, data);

    /*
     * handle '$' and '#' chars prefix
     */
    Token t = getFirstToken();
    int pos = -1;
    while (t != null && (pos = t.image.lastIndexOf(rsvc.getParserConfiguration().getHashChar())) == -1)
    {
        t = t.next;
    }
    if (t != null && pos > 0)
    {
        morePrefix = t.image.substring(0, pos);
    }

    /* handle structured space gobbling */
    if (rsvc.getSpaceGobbling() == SpaceGobbling.STRUCTURED && postfix.length() > 0)
    {
        NodeUtils.fixIndentation(this, prefix);
    }

    cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
    return obj;
}
 
示例14
/**
 * @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
{
	Object obj = super.init(context, data);
	saveTokenImages();
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例15
/**
 * @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
{
	Object obj = super.init(context, data);
	saveTokenImages();
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例16
/**
 * @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
{
	Object obj = super.init(context, data);
	saveTokenImages();
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例17
/**
 * @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
{
	Object obj = super.init(context, data);
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例18
/**
 * @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
{
    Object obj = super.init(context, data);
    cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
    return obj;
}
 
示例19
/**
 * @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
{
	Object obj = super.init(context, data);
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例20
/**
 * @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
{
    Object obj = super.init(context, data);
    cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
    return obj;
}
 
示例21
/**
 * @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
{
	Object obj = super.init(context, data);
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例22
/**
 * @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
{
	Object obj = super.init(context, data);
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例23
/**
 * @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
{
	Object obj = super.init(context, data);
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例24
/**
 * @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
{
	Object obj = super.init(context, data);
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例25
/**
 * @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
{
	Object obj = super.init(context, data);
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例26
/**
 * @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
{
    Object obj = super.init(context, data);
     cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
    return obj;
}
 
示例27
/**
 * @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
{
	Object obj = super.init(context, data);
	saveTokenImages();
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例28
/**
 * @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
{
	Object obj = super.init(context, data);
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例29
/**
 * @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
{
	Object obj = super.init(context, data);
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}
 
示例30
/**
 * @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
{
	Object obj = super.init(context, data);
	cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
	return obj;
}