Class BaseFactory

  • Direct Known Subclasses:
    DefaultFactory

    public abstract class BaseFactory
    extends Factory
    Base Factory implementation. Provides utility methods for implementation.
    Version:
    $Revision: 1.4 $
    Author:
    Joe Walnes
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected BaseFactory​(Config config)
      Constructor for default implementation of Factory.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • config

        protected Config config
        ServletConfig or FilterConfig.
      • decoratorMapper

        protected DecoratorMapper decoratorMapper
        Instance of 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.
      • pageParsers

        protected java.util.Map pageParsers
        Map that associates content-types with PageParser instances.
      • excludeUrls

        protected PathMapper excludeUrls
        A map of paths that are excluded from decoration
    • Method Detail

      • getPageParser

        public PageParser getPageParser​(java.lang.String contentType)
        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 class Factory
        Parameters:
        contentType - The MIME content-type of the data to be parsed
        Returns:
        Appropriate PageParser for reading data, or null if no suitable parser was found.
      • shouldParsePage

        public boolean shouldParsePage​(java.lang.String contentType)
        Determine whether a Page of given content-type should be parsed or not.
        Specified by:
        shouldParsePage in class Factory
      • isPathExcluded

        public 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.
        Specified by:
        isPathExcluded in class Factory
        Parameters:
        path -
        Returns:
        whether the path is excluded
      • clearDecoratorMappers

        protected void clearDecoratorMappers()
        Clear all current DecoratorMappers.
      • pushDecoratorMapper

        protected void pushDecoratorMapper​(java.lang.String className,
                                           java.util.Properties properties)
        Push new DecoratorMapper onto end of chain.
      • clearParserMappings

        protected void clearParserMappings()
        Clear all PageParser mappings.
      • mapParser

        protected void mapParser​(java.lang.String contentType,
                                 java.lang.String className)
        Map new PageParser to given content-type. contentType = null signifies default PageParser for unknown content-types.
      • addExcludeUrl

        protected void addExcludeUrl​(java.lang.String path)
      • clearExcludeUrls

        protected void clearExcludeUrls()
        Clears all exclude URLs.