Package org.apache.solr.common
Class EmptyEntityResolver
java.lang.Object
org.apache.solr.common.EmptyEntityResolver
This class provides several singletons of entity resolvers used by SAX and StAX in the Java API.
This is needed to make secure XML parsers, that don't resolve external entities from untrusted
sources.
This class also provides static methods to configure SAX and StAX parsers to be safe.
Parsers will get an empty, closed stream for every external entity, so they will not fail while parsing (unless the external entity is needed for processing!).
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconfigureSAXParserFactory(SAXParserFactory saxFactory) Configures the givenSAXParserFactoryto do secure XML processing of untrusted sources.static voidconfigureXMLInputFactory(XMLInputFactory inputFactory) Configures the givenXMLInputFactoryto not parse external entities.
-
Field Details
-
SAX_INSTANCE
-
STAX_INSTANCE
-
-
Method Details
-
configureSAXParserFactory
Configures the givenSAXParserFactoryto do secure XML processing of untrusted sources. It is required to also setSAX_INSTANCEon the createdXMLReader.- See Also:
-
configureXMLInputFactory
Configures the givenXMLInputFactoryto not parse external entities. No further configuration on is needed, all required entity resolvers are configured.
-