Package org.apache.velocity.app.event

Examples of org.apache.velocity.app.event.EventCartridge.attachToContext()


        ve.init();

        VelocityContext context = new VelocityContext();
        EventCartridge ec = new EventCartridge();
        ec.addEventHandler(reporter);
        ec.attachToContext(context);

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


        ve.init();

        VelocityContext context = new VelocityContext();
        EventCartridge ec = new EventCartridge();
        ec.addEventHandler(reporter);
        ec.attachToContext(context);

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

            public boolean internalContainsKey(Object key) {
                return descriptorProps.containsKey(key) || props.containsKey(key);
            }
        };

        eventCartridge.attachToContext(context); // ����ʹ��${a.b.c}
        context.put("D", "$"); // ������${D}������$

        return context;
    }
View Full Code Here

         *  Context
         */

        EventCartridge ec = new EventCartridge();
        ec.addEventHandler(this);
        ec.attachToContext( context );
 
        try
        {
            /*
             *  lets test each type of event handler individually
View Full Code Here

             *  event cartridge stuff
             */

            EventCartridge ec = new EventCartridge();
            ec.addEventHandler(this);
            ec.attachToContext( context );

            /*
             *  make a writer, and merge the template 'against' the context
             */

 
View Full Code Here

         *  Context
         */

        EventCartridge ec = new EventCartridge();
        ec.addEventHandler(this);
        ec.attachToContext( inner );
 
        /*
         *  now wrap the event cartridge - we want to make sure that
         *  we can do this w/o harm
         */
 
View Full Code Here

                // build the HTML body
                vt = velocityEngine.getTemplate(template.getHtmlBodyTemplateResourcePath());
                // HTML-escape all content inserted
                EventCartridge ec = new EventCartridge();
                ec.addEventHandler(new EscapeHtmlReference());
                ec.attachToContext(velocityContext);
                writer.getBuffer().setLength(0);
                vt.merge(velocityContext, writer);
                emailerFactory.setHtmlBody(response, writer.toString());
            }
View Full Code Here

            {
                vt = velocityEngine.getTemplate(htmlBodyTemplateResourcePath);
                // HTML-escape all content inserted
                EventCartridge ec = new EventCartridge();
                ec.addEventHandler(new EscapeHtmlReference());
                ec.attachToContext(velocityContext);
                if (!addresses.isEmpty())
                {
                    velocityContext.put("hasReplyAddress", false);
                    writer.getBuffer().setLength(0);
                    vt.merge(velocityContext, writer);
View Full Code Here

    initializeVelocityEngine();

    Context context = (VelocityContextImpl) super.getContext();
    EventCartridge events = new EventCartridge();
    events.addEventHandler(new InsertionHandler());
    events.attachToContext(context);

    Reader reader = template;
    try {
      velocityEngine.evaluate(context, writer, "", reader);
    } finally {
View Full Code Here

        // listen for exceptions so that we can report them
        EventCartridge ec = ictx.getEventCartridge();
        if (ec == null) {
            ec = new EventCartridge();
            ec.attachToContext(ictx);
            ec.addEventHandler(this);
        }

        // if our application failed to initialize, fail with a 500 response
        if (_app == null) {
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.