Class BaseFactory
java.lang.Object
com.opensymphony.module.sitemesh.Factory
com.opensymphony.module.sitemesh.factory.BaseFactory
- All Implemented Interfaces:
PageParserSelector
- Direct Known Subclasses:
DefaultFactory
Base Factory implementation. Provides utility methods for implementation.
- Version:
- $Revision: 1.9 $
- Author:
- Joe Walnes
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Config
ServletConfig or FilterConfig.protected DecoratorMapper
Instance ofDecoratorMapper
.protected PathMapper
A map of paths that are excluded from decorationprotected Map
Map that associates content-types with PageParser instances. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseFactory
(Config config) Constructor for default implementation of Factory. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addExcludeUrl
(String path) protected void
Clear all current DecoratorMappers.protected void
Clears all exclude URLs.protected void
Clear all PageParser mappings.Return instance of DecoratorMapper.protected DecoratorMapper
getDecoratorMapper
(Class decoratorMapperClass) getPageParser
(String contentType) Create a PageParser suitable for the given content-type.boolean
isPathExcluded
(String path) Returnstrue
if the supplied path matches one of the exclude URLs specified in sitemesh.xml, otherwise returnsfalse
.protected void
Map new PageParser to given content-type.protected void
pushDecoratorMapper
(String className, Properties properties) Push new DecoratorMapper onto end of chain.boolean
shouldParsePage
(String contentType) Determine whether a Page of given content-type should be parsed or not.Methods inherited from class com.opensymphony.module.sitemesh.Factory
getInstance, refresh
-
Field Details
-
config
ServletConfig or FilterConfig. -
decoratorMapper
Instance ofDecoratorMapper
. 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. -
pageParsers
Map that associates content-types with PageParser instances. -
excludeUrls
A map of paths that are excluded from decoration
-
-
Constructor Details
-
BaseFactory
Constructor for default implementation of Factory. Should never be called by client. Singleton instance should be obtained instead.- See Also:
-
-
Method Details
-
getDecoratorMapper
Return instance of DecoratorMapper.- Specified by:
getDecoratorMapper
in classFactory
-
getPageParser
Create a PageParser suitable for the given content-type.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.- Specified by:
getPageParser
in interfacePageParserSelector
- Specified by:
getPageParser
in classFactory
- Parameters:
contentType
- The MIME content-type of the data to be parsed- Returns:
- Appropriate
PageParser
for reading data, ornull
if no suitable parser was found.
-
shouldParsePage
Determine whether a Page of given content-type should be parsed or not.- Specified by:
shouldParsePage
in interfacePageParserSelector
- Specified by:
shouldParsePage
in classFactory
-
isPathExcluded
Returnstrue
if the supplied path matches one of the exclude URLs specified in sitemesh.xml, otherwise returnsfalse
.- Specified by:
isPathExcluded
in classFactory
- Parameters:
path
-- Returns:
- whether the path is excluded
-
clearDecoratorMappers
protected void clearDecoratorMappers()Clear all current DecoratorMappers. -
pushDecoratorMapper
Push new DecoratorMapper onto end of chain. -
getDecoratorMapper
protected DecoratorMapper getDecoratorMapper(Class decoratorMapperClass) throws InstantiationException, IllegalAccessException -
clearParserMappings
protected void clearParserMappings()Clear all PageParser mappings. -
mapParser
Map new PageParser to given content-type. contentType = null signifies default PageParser for unknown content-types. -
addExcludeUrl
-
clearExcludeUrls
protected void clearExcludeUrls()Clears all exclude URLs.
-