Package org.jpublish

Examples of org.jpublish.Page


        return root;
    }

    public void render(JPublishContext context, String path, Reader in, Writer out) throws IOException, ViewRenderException {
        try {
            Page page = (Page) context.get(JPublishContext.JPUBLISH_PAGE);
            Object viewContext = createViewContext(context, path);

            Template template = fmConfig.getTemplate(path, UtilHttp.getLocale(context.getRequest()));
            template.setObjectWrapper(BeansWrapper.getDefaultInstance());
View Full Code Here


            throw new ViewRenderException(e);
        }
    }

    private Page getPage(String path, JPublishContext context) {
        Page page = null;
        try {
            SiteContext siteContext = (SiteContext) context.get("site");
            PageInstance pi = siteContext.getPageManager().getPage(path.substring(path.lastIndexOf(":") + 1));
            if (pi != null)
                page = new Page(pi);
        } catch (Exception e) {
        }
        return page;
    }
View Full Code Here

            if (writer == null)
                throw new GeneralException("Cannot load dynamic content with a null Writer");

            // load the page
            PageInstance pageInstance = siteContext.getPageManager().getPage(path);
            Page page = new Page(pageInstance);

            context.disableCheckReservedNames(this);

            // expose the page in the context
            context.put("page", page);

            // expose components in the context
            context.put("components", new ComponentMap(context));

            if (siteContext.isProtectReservedNames()) {
                context.enableCheckReservedNames(this);
            }

            // execute the global actions
            if (executeGlobalActions(request, response, context, path, allowRedirect))
                return;

            // execute path actions
            if (executePathActions(request, response, context, path, allowRedirect))
                return;

            // execute parameter actions
            if (executeParameterActions(request, response, context, path, allowRedirect))
                return;

            // execute the page actions
            if (optionalRedirect(page.executeActions(context), path, response, allowRedirect))
                return;

            // get the template
            Template template = siteContext.getTemplateManager().getTemplate(page.getFullTemplateName());

            // merge the template
            template.merge(context, page, writer);
            writer.flush();
        } catch (FileNotFoundException e) {
View Full Code Here

        HttpServletRequest request = context.getRequest();
        HttpSession session = context.getSession();
        Security security = (Security) request.getAttribute("security");
        GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");

        Page parent = (Page) context.get("page");
        Page page = getPage(path);

        // decorate the content w/ edit images if we have permission
        if (userLogin != null && security.hasEntityPermission("CONTENTMGR", "_UPDATE", userLogin)) {
            out.write("<a href='/content/control/editContent?filePath=" + path + "'>*</a>");
        }

        /* this loops -- not good
        // if this page has a template, lets render the template
        if (page != null && parent != null && page.getPath() != parent.getPath()) {
            Debug.logInfo("Parent: " + parent.getPath(), module);
            Debug.logInfo("Page: " + page.getPath(), module);
            Debug.logInfo("Template: " + page.getFullTemplateName(), module);
            if (!page.getTemplateName().equals("basic")) {
                renderTemplate(cloneContext(context), page, out);
                return;
            }
        }
        */

        // get the view renderer for this page
        if (Debug.verboseOn()) Debug.logVerbose("Getting renderer for: " + path, module);
        String rendererName = DEFAULT_RENDERER;
        if (page != null) {
            rendererName = page.getProperty("page-renderer");
            if (rendererName == null)
                rendererName = DEFAULT_RENDERER;
        }

        ViewRenderer renderer = (ViewRenderer) renderers.get(rendererName);
View Full Code Here

     */
    public void loadConfiguration(Configuration config) throws ConfigurationException {
    }

    private Page getPage(String path) {
        Page page = null;
        try {
            PageInstance pi = siteContext.getPageManager().getPage(path.substring(path.lastIndexOf(":")+1));
            if (pi != null)
                page = new Page(pi);
        } catch (Exception e) {}
        return page;
    }
View Full Code Here

        return root;
    }

    public void render(JPublishContext context, String path, Reader in, Writer out) throws IOException, ViewRenderException {
        try {
            Page page = (Page) context.get(JPublishContext.JPUBLISH_PAGE);
            Object viewContext = createViewContext(context, path);

            Template template = fmConfig.getTemplate(path, UtilHttp.getLocale(context.getRequest()));
            template.setObjectWrapper(BeansWrapper.getDefaultInstance());
View Full Code Here

            throw new ViewRenderException(e);
        }
    }

    private Page getPage(String path, JPublishContext context) {
        Page page = null;
        try {
            SiteContext siteContext = (SiteContext) context.get("site");
            PageInstance pi = siteContext.getPageManager().getPage(path.substring(path.lastIndexOf(":") + 1));
            if (pi != null)
                page = new Page(pi);
        } catch (Exception e) {
        }
        return page;
    }
View Full Code Here

            if (writer == null)
                throw new GeneralException("Cannot load dynamic content with a null Writer");

            // load the page         
            PageInstance pageInstance = siteContext.getPageManager().getPage(path);
            Page page = new Page(pageInstance);

            context.disableCheckReservedNames(this);

            // expose the page in the context
            context.put("page", page);

            // expose components in the context
            context.put("components", new ComponentMap(context));

            if (siteContext.isProtectReservedNames()) {
                context.enableCheckReservedNames(this);
            }

            // execute the global actions
            if (executeGlobalActions(request, response, context, path, allowRedirect))
                return;

            // execute path actions
            if (executePathActions(request, response, context, path, allowRedirect))
                return;

            // execute parameter actions
            if (executeParameterActions(request, response, context, path, allowRedirect))
                return;

            // execute the page actions          
            if (optionalRedirect(page.executeActions(context), path, response, allowRedirect))
                return;

            // get the template
            Template template = siteContext.getTemplateManager().getTemplate(page.getFullTemplateName());
          
            // merge the template          
            template.merge(context, page, writer);
            writer.flush();           
        } catch (FileNotFoundException e) {
View Full Code Here

        HttpServletRequest request = context.getRequest();
        HttpSession session = context.getSession();
        Security security = (Security) request.getAttribute("security");
        GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
       
        Page parent = (Page) context.get("page");                      
        Page page = getPage(path);
           
        // decorate the content w/ edit images if we have permission             
        if (userLogin != null && security.hasEntityPermission("CONTENTMGR", "_UPDATE", userLogin)) {   
            out.write("<a href='/content/control/editContent?filePath=" + path + "'>*</a>");
        }
       
        /* this loops -- not good
        // if this page has a template, lets render the template               
        if (page != null && parent != null && page.getPath() != parent.getPath()) {
            Debug.logInfo("Parent: " + parent.getPath(), module);
            Debug.logInfo("Page: " + page.getPath(), module);
            Debug.logInfo("Template: " + page.getFullTemplateName(), module);
            if (!page.getTemplateName().equals("basic")) {               
                renderTemplate(cloneContext(context), page, out);
                return;
            }
        }
        */      
       
        // get the view renderer for this page
        if (Debug.verboseOn()) Debug.logVerbose("Getting renderer for: " + path, module);
        String rendererName = DEFAULT_RENDERER;
        if (page != null) {           
            rendererName = page.getProperty("page-renderer");              
            if (rendererName == null)
                rendererName = DEFAULT_RENDERER;
        }
                                                       
        ViewRenderer renderer = (ViewRenderer) renderers.get(rendererName);
View Full Code Here

     */
    public void loadConfiguration(Configuration config) throws ConfigurationException {              
    }
   
    private Page getPage(String path) {
        Page page = null;     
        try {       
            PageInstance pi = siteContext.getPageManager().getPage(path.substring(path.lastIndexOf(":")+1));
            if (pi != null)
                page = new Page(pi);           
        } catch (Exception e) {}     
        return page;
    }
View Full Code Here

TOP

Related Classes of org.jpublish.Page

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.