Class DigesterDefinitionsReader
- All Implemented Interfaces:
- DefinitionsReader
Definition objects from
 an XML InputStream using Digester. 
 
 This DefinitionsReader implementation expects the source to be
 passed as an InputStream. It parses XML data from the source
 and builds a Map of Definition objects.
 
 The Digester object can be configured by passing in initialization
 parameters. Currently the only parameter that is supported is the
 validating parameter. This value is set to false
 by default. To enable DTD validation for XML Definition files, give the init
 method a parameter with a key of
 org.apache.tiles.definition.digester.DigesterDefinitionsReader.PARSER_VALIDATE
 and a value of "true". 
 The Definition objects are stored internally in a Map. The Map is stored as
 an instance variable rather than a local variable in the read
 method. This means that instances of this class are not
 thread-safe and access by multiple threads must be synchronized.
 
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final StringThe handler to create definitions.protected Map<String,Definition> Stores Definition objects.protected final org.apache.commons.digester3.DigesterDigesterobject used to read Definition data from the source.protected static final StringThe handler to create list attributes.protected static final StringThe handler to create attributes.
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a new instance of DigesterDefinitionsReader.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddDefinition(Definition definition) Adds a newDefinitionto the internal Map or replaces an existing one.protected String[]Returns the registrations for local DTDs.protected voidinitSyntax(org.apache.commons.digester3.Digester digester) Initialised the syntax for reading XML files containing Tiles definitions.ReadsDefinitionvoidsetValidating(boolean validating) Sets the validation of XML files.
- 
Field Details- 
DEFINITION_HANDLER_CLASSThe handler to create definitions.- Since:
- 2.1.0
 
- 
PUT_ATTRIBUTE_HANDLER_CLASSThe handler to create attributes.- Since:
- 2.1.0
 
- 
LIST_HANDLER_CLASSThe handler to create list attributes.- Since:
- 2.1.0
 
- 
digesterprotected final org.apache.commons.digester3.Digester digesterDigesterobject used to read Definition data from the source.
- 
definitionsStores Definition objects.
 
- 
- 
Constructor Details- 
DigesterDefinitionsReaderpublic DigesterDefinitionsReader()Creates a new instance of DigesterDefinitionsReader.
 
- 
- 
Method Details- 
setValidatingpublic void setValidating(boolean validating) Sets the validation of XML files.- Parameters:
- validating-- truemeans that XML validation is turned on.- falseotherwise.
- Since:
- 3.3.0
 
- 
readReadsDefinition- Specified by:
- readin interface- DefinitionsReader
- Parameters:
- source- The- InputStreamsource from which definitions will be read.
- Returns:
- a Map of Definitionobjects read from the source.
- Throws:
- DefinitionsFactoryException- If the source is invalid or an error occurs when reading definitions.
 
- 
initSyntaxprotected void initSyntax(org.apache.commons.digester3.Digester digester) Initialised the syntax for reading XML files containing Tiles definitions.- Parameters:
- digester- The digester to initialize.
 
- 
addDefinitionAdds a newDefinitionto the internal Map or replaces an existing one.- Parameters:
- definition- The Definition object to be added.
 
- 
getRegistrationsReturns the registrations for local DTDs.- Returns:
- An array containing the locations for registrations of local DTDs.
- Since:
- 2.1.0
 
 
-