Package org.apache.velocity.app.event

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


        ReportInvalidReferences reporter = new ReportInvalidReferences();
        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


        ReportInvalidReferences reporter = new ReportInvalidReferences();
        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

        }

        final Map descriptorProps = new HashMap(currentGenerate.getConfigDescriptor().getContext());

        EventCartridge eventCartridge = new EventCartridge();
        eventCartridge.addEventHandler(new PropertiesReferenceInsertionHandler(currentGenerate.getConfigDescriptor(),
                props));

        Context context = new AbstractContext() {
            @Override
            public Object internalRemove(Object key) {
View Full Code Here

         *  event handlers (at once) and attach it to the
         *  Context
         */

        EventCartridge ec = new EventCartridge();
        ec.addEventHandler(this);
        ec.attachToContext( context );
 
        try
        {
            /*
 
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

         *  event handlers (at once) and attach it to the
         *  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

            if (htmlBodyTemplateResourcePath != null)
            {
                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);
View Full Code Here

          "Velocity engine must be defined. Use setVelocityEngine method to set it.");
    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);
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) {
            rsp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
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.