Package org.apache.struts.tiles2
Class TilesPlugin
java.lang.Object
org.apache.struts.tiles2.TilesPlugin
- All Implemented Interfaces:
PlugIn
Tiles Plugin used to initialize Tiles.
This plugin is to be used with Struts 1.1 in association with
This plugin creates one definition factory for each Struts-module. The definition factory configuration is read first from 'web.xml' (backward compatibility), then it is overloaded with values found in the plugin property values.
The plugin changes the Struts configuration by specifying a
This plugin can also be used to create one single factory for all modules. This behavior is enabled by specifying
TilesRequestProcessor.
This plugin creates one definition factory for each Struts-module. The definition factory configuration is read first from 'web.xml' (backward compatibility), then it is overloaded with values found in the plugin property values.
The plugin changes the Struts configuration by specifying a
TilesRequestProcessor as
request processor. If you want to use your own RequestProcessor,
it should subclass TilesRequestProcessor.
This plugin can also be used to create one single factory for all modules. This behavior is enabled by specifying
moduleAware=false in each
plugin properties. In this case, the definition factory
configuration file is read by the first Tiles plugin to be initialized. The order is
determined by the order of modules declaration in web.xml. The first module
is always the default one if it exists.
The plugin should be declared in each struts-config.xml file in order to
properly initialize the request processor.- Since:
- Struts 1.1
- Version:
- $Rev$ $Date$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PlugInConfigContextAdapterThe plugin config object adapted to become a context-like object, that exposes init parameters methods.protected PlugInConfigThe plugin config object provided by the ActionServlet initializing this plugin.protected booleanIs the factory module aware? -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()End plugin.voidinit(ActionServlet servlet, ModuleConfig moduleConfig) Receive notification that the specified module is being started up.protected voidSet RequestProcessor to appropriate TilesRequestProcessor.booleanGet the module aware flag.voidsetCurrentPlugInConfigObject(PlugInConfig plugInConfigObject) Method used by the ActionServlet initializing this plugin.voidsetModuleAware(boolean moduleAware) Set the module aware flag.
-
Field Details
-
moduleAware
protected boolean moduleAwareIs the factory module aware? -
currentPlugInConfigObject
The plugin config object provided by the ActionServlet initializing this plugin. -
currentPlugInConfigContextAdapter
The plugin config object adapted to become a context-like object, that exposes init parameters methods.
-
-
Constructor Details
-
TilesPlugin
public TilesPlugin()
-
-
Method Details
-
isModuleAware
public boolean isModuleAware()Get the module aware flag.- Returns:
true: user wants a single factory instance,false:user wants multiple factory instances (one per module with Struts)
-
setModuleAware
public void setModuleAware(boolean moduleAware) Set the module aware flag. This flag is only meaningful if the propertytilesUtilImplClassnameis not set.- Parameters:
moduleAware-true: user wants a single factory instance,false:user wants multiple factory instances (one per module with Struts)
-
init
Receive notification that the specified module is being started up.
- Specified by:
initin interfacePlugIn- Parameters:
servlet- ActionServlet that is managing all the modules in this web application.moduleConfig- ModuleConfig for the module with which this plugin is associated.- Throws:
ServletException- if thisPlugIncannot be successfully initialized.
-
destroy
public void destroy()End plugin. -
initRequestProcessorClass
Set RequestProcessor to appropriate TilesRequestProcessor. First, check if a RequestProcessor is specified. If yes, check if it extends the appropriateTilesRequestProcessorclass. If not, set processor class to TilesRequestProcessor.- Parameters:
config- ModuleConfig for the module with which this plugin is associated.- Throws:
ServletException- On errors.
-
setCurrentPlugInConfigObject
Method used by the ActionServlet initializing this plugin. Set the plugin config object read from module config.- Parameters:
plugInConfigObject- PlugInConfig.
-