Examples of ViewHandlerException


Examples of org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException

            (IStructuredDocumentContext) genericContext
            .getAdapter(IStructuredDocumentContext.class);

        if (context == null)
        {
            throw new ViewHandlerException(Cause.EL_NOT_FOUND);
        }

        ITextRegionContextResolver resolver =
            IStructuredDocumentContextResolverFactory.INSTANCE
            .getTextRegionResolver(context);
View Full Code Here

Examples of org.ofbiz.content.webapp.view.ViewHandlerException

        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");
        }

        request.setAttribute("_FORWARDED_FROM_CONTROL_SERVLET_",
            new Boolean(true));

        RequestDispatcher rd = request.getRequestDispatcher(page);

        if (rd == null) {
            throw new ViewHandlerException(
                "Source returned a null dispatcher (" + page + ")");
        }

        try {
            rd.forward(request, response);
        } catch (IOException ie) {
            throw new ViewHandlerException("IO Error in view", ie);
        } catch (ServletException e) {
            Throwable throwable = (e.getRootCause() != null) ? e.getRootCause()
                                                             : e;

            if (throwable instanceof JspException) {
                JspException jspe = (JspException) throwable;

                throwable = (jspe.getRootCause() != null) ? jspe.getRootCause()
                                                          : jspe;
            }

            Debug.logError(throwable, "ServletException rendering JSP view");
            throw new ViewHandlerException(e.getMessage(), throwable);
        }
    }
View Full Code Here

Examples of org.ofbiz.webapp.view.ViewHandlerException

            screens.render(page);
            screenStringRenderer.renderScreenEnd(writer, screens.getContext());
            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

                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

    }

    public void render(String name, String page, String info, String contentType, String encoding,
            HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException {
        if (UtilValidate.isEmpty(page))
            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

            context.put(BirtWorker.BIRT_LOCALE, locale);
            String birtImageDirectory = UtilProperties.getPropertyValue("birt", "birt.html.image.directory");
            context.put(BirtWorker.BIRT_IMAGE_DIRECTORY, birtImageDirectory);
            BirtWorker.exportReport(design, context, contentType, response.getOutputStream());
        } catch (BirtException e) {
            throw new ViewHandlerException("Birt Error create engine: " + e.toString(), e);
        } catch (IOException e) {
            throw new ViewHandlerException("Error in the response writer/output stream: " + e.toString(), e);
        } catch (SQLException e) {
            throw new ViewHandlerException("get connection error: " + e.toString(), e);
        } catch (GenericEntityException e) {
            throw new ViewHandlerException("generic entity error: " + e.toString(), e);
        } catch (GeneralException e) {
            throw new ViewHandlerException("general error: " + e.toString(), e);
        } catch (SAXException se) {
            String errMsg = "Error SAX rendering " + page + " view handler: " + se.toString();
            Debug.logError(se, errMsg, module);
            throw new ViewHandlerException(errMsg, se);
        } catch (ParserConfigurationException pe) {
            String errMsg = "Error parser rendering " + page + " view handler: " + pe.toString();
            Debug.logError(pe, errMsg, module);
            throw new ViewHandlerException(errMsg, pe);
        }
    }
View Full Code Here

Examples of org.ofbiz.webapp.view.ViewHandlerException

            context.put(BirtWorker.BIRT_LOCALE, locale);
            String birtImageDirectory = UtilProperties.getPropertyValue("birt", "birt.html.image.directory");
            context.put(BirtWorker.BIRT_IMAGE_DIRECTORY, birtImageDirectory);
            BirtWorker.exportReport(design, context, contentType, response.getOutputStream());
        } catch (BirtException e) {
            throw new ViewHandlerException("Birt Error create engine: " + e.toString(), e);
        } catch (IOException e) {
            throw new ViewHandlerException("Error in the response writer/output stream: " + e.toString(), e);
        } catch (SQLException e) {
            throw new ViewHandlerException("get connection error: " + e.toString(), e);
        } catch (GenericEntityException e) {
            throw new ViewHandlerException("generic entity error: " + e.toString(), e);
        } catch (GeneralException e) {
            throw new ViewHandlerException("general error: " + e.toString(), e);
        } catch (SAXException se) {
            String errMsg = "Error SAX rendering " + page + " view handler: " + se.toString();
            Debug.logError(se, errMsg, module);
            throw new ViewHandlerException(errMsg, se);
        } catch (ParserConfigurationException pe) {
            String errMsg = "Error parser rendering " + page + " view handler: " + pe.toString();
            Debug.logError(pe, errMsg, module);
            throw new ViewHandlerException(errMsg, pe);
        }
    }
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

                        if (Debug.verboseOn()) Debug.logVerbose("SCVH(0b)- dataResourceId:" + dataResourceId, module);
                    }
                } else {
                    GenericValue contentRevisionItem = delegator.findByPrimaryKeyCache("ContentRevisionItem", UtilMisc.toMap("contentId", rootContentId, "itemContentId", contentId, "contentRevisionSeqId", contentRevisionSeqId));
                    if (contentRevisionItem == null) {
                        throw new ViewHandlerException("ContentRevisionItem record not found for contentId=" + rootContentId
                                                       + ", contentRevisionSeqId=" + contentRevisionSeqId + ", itemContentId=" + contentId);
                    }
                    dataResourceId = contentRevisionItem.getString("newDataResourceId");
                    if (Debug.verboseOn()) Debug.logVerbose("SCVH(1)- contentRevisionItem:" + contentRevisionItem, module);
                    if (Debug.verboseOn()) Debug.logVerbose("SCVH(2)-contentId=" + rootContentId + ", contentRevisionSeqId=" + contentRevisionSeqId + ", itemContentId=" + contentId, module);
                    if (Debug.verboseOn()) Debug.logVerbose("SCVH(3)- dataResourceId:" + dataResourceId, module);
                }
            }
            GenericValue dataResource = delegator.findByPrimaryKeyCache("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId));
            // DEJ20080717: why are we rendering the DataResource directly instead of rendering the content?
            ByteBuffer byteBuffer = DataResourceWorker.getContentAsByteBuffer(delegator, dataResourceId, https, webSiteId, locale, rootDir);
            ByteArrayInputStream bais = new ByteArrayInputStream(byteBuffer.array());
            // hack for IE and mime types
            //String userAgent = request.getHeader("User-Agent");
            //if (userAgent.indexOf("MSIE") > -1) {
            //    Debug.log("Found MSIE changing mime type from - " + mimeTypeId, module);
            //    mimeTypeId = "application/octet-stream";
            //}
            // setup chararcter encoding and content type
            String charset = dataResource.getString("characterSetId");
            mimeTypeId = dataResource.getString("mimeTypeId");
            if (UtilValidate.isEmpty(charset)) {
                charset = servletContext.getInitParameter("charset");
            }
            if (UtilValidate.isEmpty(charset)) {
                charset = "UTF-8";
            }

            // setup content type
            String contentType2 = UtilValidate.isNotEmpty(mimeTypeId) ? mimeTypeId + "; charset=" +charset : contentType;
            String fileName = null;
            if (!UtilValidate.isEmpty(dataResource.getString("dataResourceName"))) {
                fileName = dataResource.getString("dataResourceName").replace(" ", "_"); // spaces in filenames can be a problem
            }
            UtilHttp.streamContentToBrowser(response, bais, byteBuffer.limit(), contentType2, fileName);
        } catch (GenericEntityException e) {
            throw new ViewHandlerException(e.getMessage());
        } catch (IOException e) {
            throw new ViewHandlerException(e.getMessage());
        } catch (GeneralException e) {
            throw new ViewHandlerException(e.getMessage());
        }
    }
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.