diff options
author | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2003-12-03 08:54:36 +0000 |
---|---|---|
committer | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2003-12-03 08:54:36 +0000 |
commit | 1d39a4fa10f410c5d4fdcc64413b9e0f0372f9e1 (patch) | |
tree | 83e060cf0c95e1ebfde2141bd19b9fe42e621188 /spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/listeners | |
parent | 221be8b8869ed6658b6acd0ba10d78998da33080 (diff) | |
download | moa-id-spss-1d39a4fa10f410c5d4fdcc64413b9e0f0372f9e1.tar.gz moa-id-spss-1d39a4fa10f410c5d4fdcc64413b9e0f0372f9e1.tar.bz2 moa-id-spss-1d39a4fa10f410c5d4fdcc64413b9e0f0372f9e1.zip |
Zwischenstand, compilierbar
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@69 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/listeners')
2 files changed, 77 insertions, 1 deletions
diff --git a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/listeners/ContextListener.java b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/listeners/ContextListener.java index 0b3980a50..83b6e96dd 100644 --- a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/listeners/ContextListener.java +++ b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/listeners/ContextListener.java @@ -48,6 +48,8 @@ public class ContextListener implements ServletContextListener private static Logger logger_ = Logger.getLogger(Constants.LH_LISTENERS_); + /* ---------------------------------------------------------------------------------------------------- */ + /** * Initializes the web application. * @@ -90,12 +92,20 @@ public class ContextListener implements ServletContextListener preparser.setFeature(SAX_NAMESPACES_FEATURE, true); preparser.setFeature(SAX_VALIDATION_FEATURE, true); + // Schema for Security-Layer 1.2 alpha (including LocRefContent) Properties initProps = (Properties) context.getAttribute(Constants.WSCP_INIT_PROPS_); String slSchemaLoc = initProps.getProperty(Constants.IP_SL_SCHEMA_); preparseSchema(context, preparser, slSchemaLoc); + + // Schema for MOA 1.2 String moaSchemaLoc = initProps.getProperty(Constants.IP_MOA_SCHEMA_); preparseSchema(context, preparser, moaSchemaLoc); - + + // Schema for SLXHTML 1.0 + String slxhtmlSchemaLoc = initProps.getProperty(Constants.IP_SLXHTML_SCHEMA_); + preparseSchema(context, preparser, slxhtmlSchemaLoc); + + // TODO parser is not threadsafe DOMParser xmlParser = new DOMParser(symbolTable, grammarPool); try { @@ -106,6 +116,7 @@ public class ContextListener implements ServletContextListener xmlParser.setFeature(XERCES_INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); xmlParser.setFeature(XERCES_CREATE_ENTITY_REF_NODES_FEATURE, false); xmlParser.setFeature(XERCES_DEFER_NODE_EXPANSION_, false); + xmlParser.setErrorHandler(new XMLParserErrorHandler(false, true, true)); } catch (SAXException e) diff --git a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/listeners/XMLParserErrorHandler.java b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/listeners/XMLParserErrorHandler.java new file mode 100644 index 000000000..b6fc770c0 --- /dev/null +++ b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/listeners/XMLParserErrorHandler.java @@ -0,0 +1,65 @@ +/* + * Created on 02.12.2003 + * + * (c) Stabsstelle IKT-Strategie des Bundes + */ +package at.gv.egovernment.moa.spss.slinterface.listeners; + +import org.apache.log4j.Logger; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +import at.gv.egovernment.moa.spss.slinterface.Constants; + +/** + * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at) + */ +public class XMLParserErrorHandler implements ErrorHandler +{ + private static Logger logger_ = Logger.getLogger(Constants.LH_LISTENERS_); + + private boolean reportWarning_, reportError_, reportFatal_; + + /* ---------------------------------------------------------------------------------------------------- */ + + public XMLParserErrorHandler(boolean reportWarning, boolean reportError, boolean reportFatal) + { + reportWarning_ = reportWarning; + reportError_ = reportError; + reportFatal_ = reportFatal; + } + + /* ---------------------------------------------------------------------------------------------------- */ + + /** + * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException) + */ + public void warning(SAXParseException exception) throws SAXException + { + logger_.warn("XML parser reported a warning.", exception); + if (reportWarning_) throw exception; + } + + /* ---------------------------------------------------------------------------------------------------- */ + + /** + * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException) + */ + public void error(SAXParseException exception) throws SAXException + { + logger_.error("XML parser reported an error.", exception); + if (reportError_) throw exception; + } + + /* ---------------------------------------------------------------------------------------------------- */ + + /** + * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException) + */ + public void fatalError(SAXParseException exception) throws SAXException + { + logger_.error("XML parser reported a fatal error.", exception); + if (reportFatal_) throw exception; + } +} |