Package org.geotools.util
Class PreventLocalEntityResolver
- Object
-
- PreventLocalEntityResolver
-
- All Implemented Interfaces:
Serializable,EntityResolver,EntityResolver2
public class PreventLocalEntityResolver extends Object implements EntityResolver2, Serializable
EntityResolver implementation to prevent use external entity resolution to local files.When parsing an XML entity reference to a local file a SAXException is thrown, which can be handled appropriately.
This implementation is both recommended and the default returned by
GeoTools#getEntityResolver().- Author:
- Davide Savazzi - geo-solutions.it
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringERROR_MESSAGE_BASEPrefix used for SAXException messagestatic PreventLocalEntityResolverINSTANCESingleton instance of PreventLocalEntityResolverprotected static LoggerLOGGER
-
Constructor Summary
Constructors Modifier Constructor Description protectedPreventLocalEntityResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputSourcegetExternalSubset(String name, String baseURI)InputSourceresolveEntity(String publicId, String systemId)InputSourceresolveEntity(String name, String publicId, String baseURI, String systemId)Tells the parser to resolve the systemId against the baseURI and read the entity text from that resulting absolute URI.
-
-
-
Field Detail
-
ERROR_MESSAGE_BASE
public static final String ERROR_MESSAGE_BASE
Prefix used for SAXException message- See Also:
- Constant Field Values
-
LOGGER
protected static final Logger LOGGER
-
INSTANCE
public static final PreventLocalEntityResolver INSTANCE
Singleton instance of PreventLocalEntityResolver
-
-
Method Detail
-
resolveEntity
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
- Specified by:
resolveEntityin interfaceEntityResolver- Throws:
SAXExceptionIOException
-
getExternalSubset
public InputSource getExternalSubset(String name, String baseURI) throws SAXException, IOException
- Specified by:
getExternalSubsetin interfaceEntityResolver2- Throws:
SAXExceptionIOException
-
resolveEntity
public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException
Tells the parser to resolve the systemId against the baseURI and read the entity text from that resulting absolute URI. Note that because the olderDefaultHandler.resolveEntity(), method is overridden to call this one, this method may sometimes be invoked with null name and baseURI, and with the systemId already absolutized.- Specified by:
resolveEntityin interfaceEntityResolver2- Throws:
SAXExceptionIOException
-
-