Author: nbelaevski
Date: 2008-09-08 18:44:41 -0400 (Mon, 08 Sep 2008)
New Revision: 10363
Modified:
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/config/FacesConfig.java
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/config/StateHandler.java
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/config/WebXMLParser.java
Log:
https://jira.jboss.org/jira/browse/RF-4425
Modified:
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/config/FacesConfig.java
===================================================================
---
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/config/FacesConfig.java 2008-09-08
17:17:46 UTC (rev 10362)
+++
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/config/FacesConfig.java 2008-09-08
22:44:41 UTC (rev 10363)
@@ -20,7 +20,9 @@
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
/**
* @author asmirnov
@@ -140,8 +142,17 @@
protected void parse(InputStream facesConfig) throws ParsingException {
try {
SAXParser parser = getParser();
- parser.parse(facesConfig, new FacesConfigHandler(parser
- .getXMLReader(), excludedAttributes));
+
+ //WL 10.3 parser returns new instance of XMLReader everytime
+ XMLReader reader = parser.getXMLReader();
+ FacesConfigHandler facesConfigHandler = new FacesConfigHandler(reader,
excludedAttributes);
+
+ reader.setContentHandler(facesConfigHandler);
+ reader.setEntityResolver(facesConfigHandler);
+ reader.setErrorHandler(facesConfigHandler);
+ reader.setDTDHandler(facesConfigHandler);
+
+ reader.parse(new InputSource(facesConfig));
} catch (SAXException e) {
log.log(Level.WARNING, "Exception at faces-config.xml parsing", e);
} catch (IOException e) {
Modified:
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/config/StateHandler.java
===================================================================
---
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/config/StateHandler.java 2008-09-08
17:17:46 UTC (rev 10362)
+++
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/config/StateHandler.java 2008-09-08
22:44:41 UTC (rev 10363)
@@ -35,6 +35,7 @@
if (null == nextHandler) {
depth++;
} else {
+ //TODO nick - setup all four handlers here?
getReader().setContentHandler(nextHandler);
}
}
@@ -49,6 +50,7 @@
throws SAXException {
if(depth-- == 0){
if(null != parentHandler){
+ //TODO nick - see to-do in startElement method
getReader().setContentHandler(parentHandler);
}
endLastElement();
Modified:
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/config/WebXMLParser.java
===================================================================
---
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/config/WebXMLParser.java 2008-09-08
17:17:46 UTC (rev 10362)
+++
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/config/WebXMLParser.java 2008-09-08
22:44:41 UTC (rev 10363)
@@ -14,7 +14,9 @@
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
/**
* @author asmirnov
@@ -45,10 +47,19 @@
factory.setValidating(false);
factory.setNamespaceAware(true);
SAXParser parser = factory.newSAXParser();
+ //WL 10.3 parser returns new instance of XMLReader everytime
+ XMLReader reader = parser.getXMLReader();
+
// Parse web.xml with state-avare content handler.
- WebappHandler webappHandler = new WebappHandler(parser
- .getXMLReader());
- parser.parse(webXml, webappHandler);
+ WebappHandler webappHandler = new WebappHandler(reader);
+
+ reader.setContentHandler(webappHandler);
+ reader.setEntityResolver(webappHandler);
+ reader.setErrorHandler(webappHandler);
+ reader.setDTDHandler(webappHandler);
+
+ reader.parse(new InputSource(webXml));
+
// Calculate Faces Servlet and filter mappings.
for (ServletBean servlet : webappHandler.getServlets()) {
if (FACES_SERVLET_CLASS.equals(servlet.getClassName())) {