com.sitemesh
Class Factory

java.lang.Object
  |
  +--com.sitemesh.Factory

public class Factory
extends java.lang.Object

Factory responsible for creating appropriate instances of implementations. This is a singleton and is obtained through getInstance(javax.servlet.Config).

Version:
$Revision: 1.7 $
Author:
Joe Walnes

Field Summary
protected  javax.servlet.Config config
          ServletConfig or FilterConfig.
protected  DecoratorMapper decoratorMapper
          Instance of DecoratorMapper.
 
Constructor Summary
protected Factory(javax.servlet.Config config)
          Constructor for default implementation of Factory.
 
Method Summary
 DecoratorMapper getDecoratorMapper()
          Return instance of DecoratorMapper.
static Factory getInstance(javax.servlet.Config config)
          Entry-point for obtaining singleton instance of Factory.
 PageParser getPageParser(java.lang.String contentType)
          Create a PageParser suitable for the given content-type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

protected javax.servlet.Config config
ServletConfig or FilterConfig.

decoratorMapper

protected DecoratorMapper decoratorMapper
Instance of DecoratorMapper. Because it is thread-safe it can be shared by multiple clients.
Constructor Detail

Factory

protected Factory(javax.servlet.Config config)
Constructor for default implementation of Factory. Should never be called by client. Singleton instance should be obtained instead.
See Also:
getInstance(javax.servlet.Config config)
Method Detail

getInstance

public static Factory getInstance(javax.servlet.Config config)
Entry-point for obtaining singleton instance of Factory.

getDecoratorMapper

public DecoratorMapper getDecoratorMapper()
Return instance of DecoratorMapper.

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.

Never returns null.
Parameters:
contentType - The MIME content-type of the data to be parsed
Returns:
Appropriate PageParser for reading data