Package com.opensymphony.sitemesh.compatability

Examples of com.opensymphony.sitemesh.compatability.Content2HTMLPage


        if (content instanceof HTMLPage) {
            htmlPage = (HTMLPage) content;
        } else if (content instanceof TokenizedHTMLPage2Content) {
            htmlPage = ((TokenizedHTMLPage2Content)content).getPage();
        } else {
            htmlPage = new Content2HTMLPage(content);
        }
        return htmlPage;
    }
View Full Code Here


            velocityManager.init(servletContext);

            // get encoding
            String encoding = getEncoding();

            HTMLPage htmlPage = new Content2HTMLPage(content, request);

            // get the template and context
            org.apache.velocity.Template template = velocityManager.getVelocityEngine().getTemplate(oldDecorator.getPage(), encoding);
            Context context = velocityManager.createContext(ctx.getValueStack(), request, response);

            // put the page in the context
            context.put("page", htmlPage);
            context.put("head", htmlPage.getHead());
            context.put("title", htmlPage.getTitle());
            context.put("body", htmlPage.getBody());

            // finally, render it
            PrintWriter writer = response.getWriter();
            template.merge(context, writer);
            writer.flush();
View Full Code Here

            if (model == null) {
                model = freemarkerManager.buildTemplateModel(ctx.getValueStack(), ctx.getActionInvocation().getAction(), servletContext, request, response, config.getObjectWrapper());
            }

            // populate the hash with the page
            HTMLPage htmlPage = new Content2HTMLPage(content, request);
            model.put("page", htmlPage);
            model.put("head", htmlPage.getHead());
            model.put("title", htmlPage.getTitle());
            model.put("body", htmlPage.getBody());
            model.put("page.properties", new SimpleHash(htmlPage.getProperties()));

            // finally, render it
            template.process(model, response.getWriter());
        } catch (Exception e) {
            String msg = "Error applying decorator to request: " + request.getRequestURL() + "?" + request.getQueryString() + " with message:" + e.getMessage();
View Full Code Here

    public com.opensymphony.sitemesh.Decorator selectDecorator(Content content, SiteMeshContext context) {
        SiteMeshWebAppContext webAppContext = (SiteMeshWebAppContext) context;
        HttpServletRequest request = webAppContext.getRequest();
        com.opensymphony.module.sitemesh.Decorator decorator =
                decoratorMapper.getDecorator(request, new Content2HTMLPage(content, request));
        if (decorator == null || decorator.getPage() == null) {
            return new NoDecorator();
        } else {
            return new OldDecorator2NewStrutsFreemarkerDecorator(decorator);
        }
View Full Code Here

    public com.opensymphony.sitemesh.Decorator selectDecorator(Content content, SiteMeshContext context) {
        SiteMeshWebAppContext webAppContext = (SiteMeshWebAppContext) context;
        HttpServletRequest request = webAppContext.getRequest();
        Decorator decorator =
                decoratorMapper.getDecorator(request, new Content2HTMLPage(content, request));
        if (decorator == null || decorator.getPage() == null) {
            return new NoDecorator();
        } else {
            return new OldDecorator2NewStrutsVelocityDecorator(decorator);
        }
View Full Code Here

TOP

Related Classes of com.opensymphony.sitemesh.compatability.Content2HTMLPage

Copyright © 2018 www.massapicom. 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.