Package de.innovationgate.wgpublisher.webtml.utils

Examples of de.innovationgate.wgpublisher.webtml.utils.HttpErrorException


                List debugDocuments = WGACore.getDebugDocumentsList(session);
                if (index == -1) {
                    index = debugDocuments.size() - 1;
                }
                if (index >= debugDocuments.size()) {
                    throw new HttpErrorException(HttpServletResponse.SC_BAD_REQUEST, "Index out of range: " + index + " where maximum index is " + (debugDocuments.size() - 1), null);
                }
                else {
                    Document doc = (Document) debugDocuments.get(index);
                    Element element = (Element) doc.selectSingleNode(request.getParameter("root"));
                    doc = DocumentFactory.getInstance().createDocument(element.createCopy());
                    doc.getRootElement().addAttribute("index", String.valueOf(index));

                    try {
                        DOMWriter domWriter = new DOMWriter();
                        org.w3c.dom.Document domDocument = domWriter.write(doc);

                        Transformer trans = getDebugTagsTransformer(request.getParameter("throwAway") != null);
                        trans.transform(new DOMSource(domDocument), new StreamResult(response.getOutputStream()));
                    }
                    catch (TransformerConfigurationException e) {
                        response.sendError(500, e.getMessageAndLocation());
                        e.printStackTrace();
                    }
                    catch (TransformerFactoryConfigurationError e) {
                        response.sendError(500, e.getMessage());
                        e.printStackTrace();
                    }
                    catch (TransformerException e) {
                        response.sendError(500, e.getMessageAndLocation());
                        e.printStackTrace();
                    }
                    catch (IOException e) {
                        response.sendError(500, e.getMessage());
                        e.printStackTrace();
                    }
                    catch (DocumentException e) {
                        response.sendError(500, e.getMessage());
                        e.printStackTrace();
                    }
                }
            }
            else {
                throw new HttpErrorException(HttpServletResponse.SC_BAD_REQUEST, "You must include either parameter index or url to address the debug document to show", null);
            }
        }
View Full Code Here


   
    this.maybeResponsibleDesign = maybeResponsibleDesign;
     
    this.exception = exception;
    if (this.exception instanceof HttpErrorException) {
      HttpErrorException httpError = (HttpErrorException) this.exception;
      this.mainMessage = "An error occured while processing your request";
      this.subMessage = "Http Error "  + httpError.getCode() + " - " + httpError.getMessage();
      this.detailMessage = null;
      this.stackTrace = "(None)";
            this.errorCode = httpError.getCode();
            this.httpError = true;
    }
    else {
      this.mainMessage =  "The page you requested is currently not available";
      this.subMessage = "The cause might be maintenance operations or technical problems. Please try again later.";
View Full Code Here

TOP

Related Classes of de.innovationgate.wgpublisher.webtml.utils.HttpErrorException

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.