public void setup(SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws ProcessingException, SAXException, IOException { super.setup(resolver, objectModel, src, parameters); this.exception = parameters.getParameter("exception", super.source); this.code = Integer.parseInt(parameters.getParameter("code", "0")); // Throw exception in the setup phase? if (parameters.getParameterAsBoolean("setup", false)) { ExceptionAction.exception(this.exception, this.code); } }
/** Overridden from superclass. */ public void generate() throws ProcessingException, SAXException, IOException { this.contentHandler.startDocument(); this.contentHandler.startElement("", "html", "html", XMLUtils.EMPTY_ATTRIBUTES); this.contentHandler.startElement("", "body", "body", XMLUtils.EMPTY_ATTRIBUTES); this.contentHandler.startElement("", "p", "p", XMLUtils.EMPTY_ATTRIBUTES); String text = ExceptionAction.exception(this.exception, this.code); this.contentHandler.characters(text.toCharArray(), 0, text.length()); this.contentHandler.endElement("", "p", "p"); this.contentHandler.endElement("", "body", "body"); this.contentHandler.endElement("", "html", "html"); this.contentHandler.endDocument(); }