Examples of ViewHandlerException


Examples of org.ofbiz.webapp.view.ViewHandlerException

                Debug.logInfo("SCVH(0b)- dataResourceId:" + dataResourceId, module);
                dataResource = delegator.findByPrimaryKey("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId));
             } else {
                GenericValue contentRevisionItem = delegator.findByPrimaryKeyCache("ContentRevisionItem", UtilMisc.toMap("contentId", contentId, "itemContentId", contentId, "contentRevisionSeqId", contentRevisionSeqId));
                if (contentRevisionItem == null) {
                    throw new ViewHandlerException("ContentRevisionItem record not found for contentId=" + contentId
                                                   + ", contentRevisionSeqId=" + contentRevisionSeqId + ", itemContentId=" + contentId);
                }
                Debug.logInfo("SCVH(1)- contentRevisionItem:" + contentRevisionItem, module);
                Debug.logInfo("SCVH(2)-contentId=" + contentId
                        + ", contentRevisionSeqId=" + contentRevisionSeqId + ", itemContentId=" + contentId, module);
View Full Code Here

Examples of org.ofbiz.webapp.view.ViewHandlerException

        this.servletContext = context;
        config.setCacheStorage(new OfbizCacheStorage("unknown"));
        try {
            config.setDirectoryForTemplateLoading(new File(servletContext.getRealPath("/")));
        } catch (IOException e) {
            throw new ViewHandlerException("Could not create file for webapp root path", e);
        }
    }
View Full Code Here

Examples of org.ofbiz.webapp.view.ViewHandlerException

    }

    public void render(String name, String page, String info, String contentType, String encoding,
            HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException {
        if (page == null || page.length() == 0)
            throw new ViewHandlerException("Invalid template source");

        // make the root context (data model) for freemarker
        MapStack<String> context = MapStack.create();
        prepOfbizRoot(context, request, response);

        // process the template & flush the output
        try {
            if (page.startsWith("component://")) {
                FreeMarkerWorker.renderTemplateAtLocation(page, context, response.getWriter());
            } else {
                // backwards compatibility
                Template template = config.getTemplate(page);
                FreeMarkerWorker.renderTemplate(template, context, response.getWriter());
            }
            response.flushBuffer();
        } catch (TemplateException te) {
            throw new ViewHandlerException("Problems processing Freemarker template", te);
        } catch (IOException ie) {
            throw new ViewHandlerException("Problems writing to output stream", ie);
        }
    }
View Full Code Here

Examples of org.ofbiz.webapp.view.ViewHandlerException

    public void render(String name, String page, String info, String contentType, String encoding, HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException {
        // some containers call filters on EVERY request, even forwarded ones,
        // so let it know that it came from the control servlet

        if (request == null)
            throw new ViewHandlerException("Null HttpServletRequest object");
        if (page == null || page.length() == 0)
            throw new ViewHandlerException("Null or empty source");

        if (Debug.infoOn()) Debug.logInfo("Retreiving HTTP resource at: " + page, module);
        try {
            String result = null;

            List entityList = (List)request.getAttribute("entityList");
            SimpleSequence simpleList = new SimpleSequence(entityList);
            Map<String, Object> ctx = FastMap.newInstance();
            ctx.put("entityList", simpleList);
            StringWriter outWriter = new StringWriter();
            Template template = getDocTemplate(page);
            template.process(ctx, outWriter);
            outWriter.close();
            result = outWriter.toString();
            Debug.logInfo(result, result);
            response.getWriter().print(result);
        } catch (FileNotFoundException e) {
            throw new ViewHandlerException(e.getMessage(), e);
        } catch (IOException e) {
            throw new ViewHandlerException("IO Error in view", e);
        } catch (URISyntaxException e) {
            throw new ViewHandlerException(e.getMessage(), e);
        } catch (TemplateException e) {
            throw new ViewHandlerException(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.ofbiz.webapp.view.ViewHandlerException

            // this is the object used to render forms from their definitions
            screens.getContext().put("formStringRenderer", new XmlFormRenderer(request, response));
            screens.getContext().put("simpleEncoder", StringUtil.xmlEncoder);
            screens.render(page);
        } catch (IOException e) {
            throw new ViewHandlerException("Error in the response writer/output stream: " + e.toString(), e);
        } catch (SAXException e) {
            throw new ViewHandlerException("XML Error rendering page: " + e.toString(), e);
        } catch (ParserConfigurationException e) {
            throw new ViewHandlerException("XML Error rendering page: " + e.toString(), e);
        } catch (GeneralException e) {
            throw new ViewHandlerException("Lower level error rendering page: " + e.toString(), e);
        }
    }
View Full Code Here

Examples of org.ofbiz.webapp.view.ViewHandlerException

            screens.getContext().put("simpleEncoder", StringUtil.getEncoder(UtilProperties.getPropertyValue("widget", getName() + ".encoder")));
            screens.render(page);
            writer.flush();
        } catch (TemplateException e) {
            Debug.logError(e, "Error initializing screen renderer", module);
            throw new ViewHandlerException(e.getMessage());
        } catch (IOException e) {
            throw new ViewHandlerException("Error in the response writer/output stream: " + e.toString(), e);
        } catch (SAXException e) {
            throw new ViewHandlerException("XML Error rendering page: " + e.toString(), e);
        } catch (ParserConfigurationException e) {
            throw new ViewHandlerException("XML Error rendering page: " + e.toString(), e);
        } catch (GeneralException e) {
            throw new ViewHandlerException("Lower level error rendering page: " + e.toString(), e);
        }
    }
View Full Code Here

Examples of org.ofbiz.webapp.view.ViewHandlerException

            response.setContentType("text/html");
            response.getWriter().write(writer.toString());
            writer.close();
        } catch (Exception x) {
            Debug.logError("Multiple errors rendering FOP", module);
            throw new ViewHandlerException("Multiple errors rendering FOP", x);
        }
    }
View Full Code Here

Examples of org.ofbiz.webapp.view.ViewHandlerException

            screens.getContext().put("formStringRenderer", new HtmlFormRenderer(request, response));
            screens.getContext().put("simpleEncoder", StringUtil.htmlEncoder);
            screens.render(page);
            writer.flush();
        } catch (IOException e) {
            throw new ViewHandlerException("Error in the response writer/output stream: " + e.toString(), e);
        } catch (SAXException e) {
            throw new ViewHandlerException("XML Error rendering page: " + e.toString(), e);
        } catch (ParserConfigurationException e) {
            throw new ViewHandlerException("XML Error rendering page: " + e.toString(), e);
        } catch (GeneralException e) {
            throw new ViewHandlerException("Lower level error rendering page: " + e.toString(), e);
        } catch (TemplateModelException e) {
            throw new ViewHandlerException("Whitespace compression error rendering page: " + e.toString(), e);
        }
    }
View Full Code Here

Examples of org.ofbiz.webapp.view.ViewHandlerException

                Debug.logInfo("SCVH(0b)- dataResourceId:" + dataResourceId, module);
                dataResource = delegator.findByPrimaryKey("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId));
             } else {
                GenericValue contentRevisionItem = delegator.findByPrimaryKeyCache("ContentRevisionItem", UtilMisc.toMap("contentId", contentId, "itemContentId", contentId, "contentRevisionSeqId", contentRevisionSeqId));
                if (contentRevisionItem == null) {
                    throw new ViewHandlerException("ContentRevisionItem record not found for contentId=" + contentId
                                                   + ", contentRevisionSeqId=" + contentRevisionSeqId + ", itemContentId=" + contentId);
                }
                Debug.logInfo("SCVH(1)- contentRevisionItem:" + contentRevisionItem, module);
                Debug.logInfo("SCVH(2)-contentId=" + contentId
                        + ", contentRevisionSeqId=" + contentRevisionSeqId + ", itemContentId=" + contentId, module);
View Full Code Here

Examples of org.ofbiz.webapp.view.ViewHandlerException

            response.setContentType("text/html");
            response.getWriter().write(writer.toString());
            writer.close();
        } catch (Exception x) {
            Debug.logError("Multiple errors rendering FOP", module);
            throw new ViewHandlerException("Multiple errors rendering FOP", x);
        }
    }
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.