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 String
ERROR_MESSAGE_BASE
Prefix used for SAXException messagestatic PreventLocalEntityResolver
INSTANCE
Singleton instance of PreventLocalEntityResolverprotected static Logger
LOGGER
-
Constructor Summary
Constructors Modifier Constructor Description protected
PreventLocalEntityResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputSource
getExternalSubset(String name, String baseURI)
InputSource
resolveEntity(String publicId, String systemId)
InputSource
resolveEntity(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:
resolveEntity
in interfaceEntityResolver
- Throws:
SAXException
IOException
-
getExternalSubset
public InputSource getExternalSubset(String name, String baseURI) throws SAXException, IOException
- Specified by:
getExternalSubset
in interfaceEntityResolver2
- Throws:
SAXException
IOException
-
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:
resolveEntity
in interfaceEntityResolver2
- Throws:
SAXException
IOException
-
-