public abstract class BaseFactory extends Factory
Modifier and Type | Field and Description |
---|---|
protected Config |
config
ServletConfig or FilterConfig.
|
protected DecoratorMapper |
decoratorMapper
Instance of
DecoratorMapper . |
protected PathMapper |
excludeUrls
A map of paths that are excluded from decoration
|
protected java.util.Map |
pageParsers
Map that associates content-types with PageParser instances.
|
Modifier | Constructor and Description |
---|---|
protected |
BaseFactory(Config config)
Constructor for default implementation of Factory.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addExcludeUrl(java.lang.String path) |
protected void |
clearDecoratorMappers()
Clear all current DecoratorMappers.
|
protected void |
clearExcludeUrls()
Clears all exclude URLs.
|
protected void |
clearParserMappings()
Clear all PageParser mappings.
|
DecoratorMapper |
getDecoratorMapper()
Return instance of DecoratorMapper.
|
protected DecoratorMapper |
getDecoratorMapper(java.lang.Class decoratorMapperClass) |
PageParser |
getPageParser(java.lang.String contentType)
Create a PageParser suitable for the given content-type.
|
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 . |
protected void |
mapParser(java.lang.String contentType,
java.lang.String className)
Map new PageParser to given content-type.
|
protected void |
pushDecoratorMapper(java.lang.String className,
java.util.Properties properties)
Push new DecoratorMapper onto end of chain.
|
boolean |
shouldParsePage(java.lang.String contentType)
Determine whether a Page of given content-type should be parsed or not.
|
getInstance, refresh
protected Config config
protected DecoratorMapper decoratorMapper
DecoratorMapper
.
Because it is thread-safe, it can be shared by multiple clients. This
is only the last DecoratorMapper in the chain, and all parents will be
automatically delegated to it.protected java.util.Map pageParsers
protected PathMapper excludeUrls
protected BaseFactory(Config config)
public DecoratorMapper getDecoratorMapper()
getDecoratorMapper
in class Factory
public PageParser getPageParser(java.lang.String contentType)
For example, if the supplied parameter is text/html
a parser shall be returned that can parse HTML accordingly. Returns
null if no parser can be found for the supplied content type.
getPageParser
in interface PageParserSelector
getPageParser
in class Factory
contentType
- 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 interface PageParserSelector
shouldParsePage
in class Factory
public boolean isPathExcluded(java.lang.String path)
true
if the supplied path matches one of the exclude
URLs specified in sitemesh.xml, otherwise returns false
.isPathExcluded
in class Factory
path
- protected void clearDecoratorMappers()
protected void pushDecoratorMapper(java.lang.String className, java.util.Properties properties)
protected DecoratorMapper getDecoratorMapper(java.lang.Class decoratorMapperClass) throws java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.IllegalAccessException
protected void clearParserMappings()
protected void mapParser(java.lang.String contentType, java.lang.String className)
protected void addExcludeUrl(java.lang.String path)
protected void clearExcludeUrls()