Examples of VelocityManager

  • org.apache.struts2.views.velocity.VelocityManager
    Manages the environment for Velocity result types

  • Examples of com.opensymphony.webwork.portlet.velocity.VelocityManager

            //request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY,
            // stack);
            //Moved to WebWorkPortlet doService()

            VelocityManager velocityManager = VelocityManager.getInstance();
            Context resultContext = velocityManager.createContext(stack, request, response);

            response.setContentType("text/html");

            try {
                String location = (String) ActionContext.getContext().get("template");
                Template template = velocityManager.getVelocityEngine().getTemplate(location);

                Writer writer = pageContext.getOut();
                template.merge(resultContext, writer);
                writer.flush();
            } catch (Exception e) {
    View Full Code Here

    Examples of org.apache.struts2.views.velocity.VelocityManager

                if (encoding != null) {
                    contentType = contentType + ";charset=" + encoding;
                }

                VelocityManager velocityManager = VelocityManager.getInstance();
                Template t = getTemplate(stack,
                        velocityManager.getVelocityEngine(), invocation,
                        finalLocation, encoding);

                Context context = createContext(velocityManager, stack, request,
                        response, finalLocation);
                Writer writer = new OutputStreamWriter(response.getOutputStream(),
    View Full Code Here

    Examples of org.apache.struts2.views.velocity.VelocityManager

                if (encoding != null) {
                    contentType = contentType + ";charset=" + encoding;
                }

                VelocityManager velocityManager = VelocityManager.getInstance();
                Template t = getTemplate(stack, velocityManager.getVelocityEngine(), invocation, finalLocation, encoding);

                Context context = createContext(velocityManager, stack, request, response, finalLocation);
                Writer writer = new OutputStreamWriter(response.getOutputStream(), encoding);

    View Full Code Here

    Examples of org.apache.struts2.views.velocity.VelocityManager

            ServletContext servletContext = (ServletContext) actionContext.get(ServletActionContext.SERVLET_CONTEXT);
            HttpServletRequest req = (HttpServletRequest) actionContext.get(ServletActionContext.HTTP_REQUEST);
            HttpServletResponse res = (HttpServletResponse) actionContext.get(ServletActionContext.HTTP_RESPONSE);

            // prepare velocity
            VelocityManager velocityManager = VelocityManager.getInstance();
            velocityManager.init(servletContext);
            VelocityEngine velocityEngine = velocityManager.getVelocityEngine();

            // get the list of templates we can use
            List templates = templateContext.getTemplate().getPossibleTemplates(this);

            // find the right template
            org.apache.velocity.Template template = null;
            String templateName = null;
            Exception exception = null;
            for (Iterator iterator = templates.iterator(); iterator.hasNext();) {
                Template t = (Template) iterator.next();
                templateName = getFinalTemplateName(t);
                try {
                    // try to load, and if it works, stop at the first one
                    template = velocityEngine.getTemplate(templateName);
                    break;
                } catch (IOException e) {
                    if (exception == null) {
                        exception = e;
                    }
                }
            }

            if (template == null) {
                LOG.error("Could not load template " + templateContext.getTemplate());
                if (exception != null) {
                    throw exception;
                } else {
                    return;
                }
            }

            if (LOG.isDebugEnabled()) {
                LOG.debug("Rendering template " + templateName);
            }

            Context context = velocityManager.createContext(templateContext.getStack(), req, res);

            Writer outputWriter = templateContext.getWriter();
            context.put("tag", templateContext.getTag());
            context.put("parameters", templateContext.getParameters());
    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.