org.apache.struts.tiles
Class DefaultTilesUtilImpl

java.lang.Object
  |
  +--org.apache.struts.tiles.DefaultTilesUtilImpl
All Implemented Interfaces:
TilesUtilInterface
Direct Known Subclasses:
StrutsModulesTilesUtilImpl

public class DefaultTilesUtilImpl
extends java.lang.Object
implements TilesUtilInterface

Default implementation of TilesUtil. This class conatains default implementation of utilities. This implementation is intended to be used without Struts


Field Summary
static java.lang.String DEFINITIONS_FACTORY
          Constant name used to store factory in servlet context
protected  org.apache.commons.logging.Log log
          Commons Logging instance.
 
Constructor Summary
DefaultTilesUtilImpl()
           
 
Method Summary
protected  DefinitionsFactory createDefinitionFactoryInstance(java.lang.String classname)
          Create Definition factory of specified classname.
 DefinitionsFactory createDefinitionsFactory(javax.servlet.ServletContext servletContext, DefinitionsFactoryConfig factoryConfig)
          Create Definition factory from specified configuration object.
 void doForward(java.lang.String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)
          Do a forward using request dispatcher.
 void doInclude(java.lang.String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)
          Do an include using request dispatcher.
 DefinitionsFactory getDefaultDefinitionsFactory(javax.servlet.ServletContext servletContext)
          Get the default definition factory from appropriate servlet context.
 DefinitionsFactory getDefinitionsFactory(javax.servlet.ServletRequest request, javax.servlet.ServletContext servletContext)
          Get definition factory from appropriate servlet context.
protected  void makeDefinitionsFactoryAccessible(DefinitionsFactory factory, javax.servlet.ServletContext servletContext)
          Make definition factory accessible to Tags.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.apache.commons.logging.Log log
Commons Logging instance.


DEFINITIONS_FACTORY

public static final java.lang.String DEFINITIONS_FACTORY
Constant name used to store factory in servlet context

See Also:
Constant Field Values
Constructor Detail

DefaultTilesUtilImpl

public DefaultTilesUtilImpl()
Method Detail

doForward

public void doForward(java.lang.String uri,
                      javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response,
                      javax.servlet.ServletContext servletContext)
               throws java.io.IOException,
                      javax.servlet.ServletException
Do a forward using request dispatcher. This method is used by the Tiles package anytime a forward is required.

Specified by:
doForward in interface TilesUtilInterface
Parameters:
uri - Uri or Definition name to forward
request - Current page request
servletContext - Current servlet context
response - Current page response
java.io.IOException
javax.servlet.ServletException

doInclude

public void doInclude(java.lang.String uri,
                      javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response,
                      javax.servlet.ServletContext servletContext)
               throws java.io.IOException,
                      javax.servlet.ServletException
Do an include using request dispatcher. This method is used by the Tiles package anytime an include is required.

Specified by:
doInclude in interface TilesUtilInterface
Parameters:
uri - Uri or Definition name to forward
request - Current page request
response - Current page response
servletContext - Current servlet context
java.io.IOException
javax.servlet.ServletException

getDefaultDefinitionsFactory

public DefinitionsFactory getDefaultDefinitionsFactory(javax.servlet.ServletContext servletContext)
Get the default definition factory from appropriate servlet context.

Specified by:
getDefaultDefinitionsFactory in interface TilesUtilInterface
Parameters:
servletContext - Current servlet context
Returns:
Definitions factory or null if not found.

getDefinitionsFactory

public DefinitionsFactory getDefinitionsFactory(javax.servlet.ServletRequest request,
                                                javax.servlet.ServletContext servletContext)
Get definition factory from appropriate servlet context.

Specified by:
getDefinitionsFactory in interface TilesUtilInterface
Parameters:
servletContext - Current servlet context
Returns:
Definitions factory or null if not found.

createDefinitionsFactory

public DefinitionsFactory createDefinitionsFactory(javax.servlet.ServletContext servletContext,
                                                   DefinitionsFactoryConfig factoryConfig)
                                            throws DefinitionsFactoryException
Create Definition factory from specified configuration object. Create an instance of the factory , with the class specified in the config object. Then, initialize this factory, and finally store the factory in appropriate context by the way of makeDefinitionsFactoryAccessible(DefinitionsFactory, ServletContext). Factory creation is done by the way of createDefinitionFactoryInstance(String)

Specified by:
createDefinitionsFactory in interface TilesUtilInterface
Parameters:
servletContext - Servlet Context passed to newly created factory.
factoryConfig - Configuration object passed to factory.
Returns:
newly created factory of type specified in the config object.
Throws:
DefinitionsFactoryException - If an error occur while initializing factory

createDefinitionFactoryInstance

protected DefinitionsFactory createDefinitionFactoryInstance(java.lang.String classname)
                                                      throws DefinitionsFactoryException
Create Definition factory of specified classname. Factory class must extends the DefinitionsFactory class. The factory is wrapped appropriately with ComponentDefinitionsFactoryWrapper if it is instance of the deprecated ComponentDefinitionsFactory class.

Parameters:
classname - Class name of the factory to create.
Returns:
newly created factory.
Throws:
DefinitionsFactoryException - If an error occur while initializing factory

makeDefinitionsFactoryAccessible

protected void makeDefinitionsFactoryAccessible(DefinitionsFactory factory,
                                                javax.servlet.ServletContext servletContext)
Make definition factory accessible to Tags. Factory is stored in servlet context.

Parameters:
factory - Factory to make accessible
servletContext - Current servlet context


Copyright 2000-2002 - Cedric Dumoulin and Apache Software Foundation