public class DefaultFactory extends BaseFactory
/WEB-INF/sitemesh.xml, or uses the
default configuration if sitemesh.xml does not exist.| Modifier and Type | Field and Description |
|---|---|
(package private) java.io.File |
configFile |
(package private) java.lang.String |
configFileName |
(package private) long |
configLastModified |
(package private) java.util.Map |
configProps |
(package private) java.io.File |
excludesFile |
(package private) java.lang.String |
excludesFileName |
config, decoratorMapper, excludeUrls, pageParsers| Constructor and Description |
|---|
DefaultFactory(Config config) |
| Modifier and Type | Method and Description |
|---|---|
DecoratorMapper |
getDecoratorMapper()
Refresh config before delegating to superclass.
|
PageParser |
getPageParser(java.lang.String contentType)
Refresh config before delegating to superclass.
|
boolean |
isPathExcluded(java.lang.String path)
Returns
true if the supplied path matches one of the exclude
URLs specified in sitemesh.xml, otherwise returns false. |
private void |
loadConfig()
Load configuration from file.
|
private void |
loadDecoratorMappers(org.w3c.dom.NodeList nodes) |
private void |
loadExcludes() |
private void |
loadExcludeUrls(org.w3c.dom.NodeList nodes)
Reads in all the url patterns to exclude from decoration.
|
private void |
loadPageParsers(org.w3c.dom.NodeList nodes)
Loop through children of 'page-parsers' element and add all 'parser' mappings.
|
private org.w3c.dom.Element |
loadSitemeshXML() |
private void |
refresh()
Check if configuration file has been modified, and if so reload it.
|
private java.lang.String |
replaceProperties(java.lang.String str)
Replaces any properties that appear in the supplied string
with their actual values
|
boolean |
shouldParsePage(java.lang.String contentType)
Refresh config before delegating to superclass.
|
addExcludeUrl, clearDecoratorMappers, clearExcludeUrls, clearParserMappings, mapParser, pushDecoratorMappergetInstance, reportjava.lang.String configFileName
java.io.File configFile
long configLastModified
java.util.Map configProps
java.lang.String excludesFileName
java.io.File excludesFile
public DefaultFactory(Config config)
public DecoratorMapper getDecoratorMapper()
getDecoratorMapper in class BaseFactorypublic PageParser getPageParser(java.lang.String contentType)
getPageParser in class BaseFactorycontentType - The MIME content-type of the data to be parsedPageParser for reading data, or
null if no suitable parser was found.public boolean shouldParsePage(java.lang.String contentType)
shouldParsePage in class BaseFactorypublic boolean isPathExcluded(java.lang.String path)
true if the supplied path matches one of the exclude
URLs specified in sitemesh.xml, otherwise returns false. This
method refreshes the config before delgating to the superclass.isPathExcluded in class BaseFactoryprivate void loadConfig()
private org.w3c.dom.Element loadSitemeshXML()
throws javax.xml.parsers.ParserConfigurationException,
java.io.IOException,
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationExceptionjava.io.IOExceptionorg.xml.sax.SAXExceptionprivate void loadExcludes()
throws javax.xml.parsers.ParserConfigurationException,
java.io.IOException,
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationExceptionjava.io.IOExceptionorg.xml.sax.SAXExceptionprivate void loadPageParsers(org.w3c.dom.NodeList nodes)
private void loadDecoratorMappers(org.w3c.dom.NodeList nodes)
private void loadExcludeUrls(org.w3c.dom.NodeList nodes)
private void refresh()
private java.lang.String replaceProperties(java.lang.String str)
str - the string to replace the properties in