Expresso 5-6

com.jcorporate.expresso.core.controller
Class ExpressoActionServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.apache.struts.action.ActionServlet
              extended bycom.jcorporate.expresso.core.controller.ExpressoActionServlet
All Implemented Interfaces:
ControllerFactory, Serializable, Servlet, ServletConfig
Direct Known Subclasses:
ActionTestServlet

public class ExpressoActionServlet
extends org.apache.struts.action.ActionServlet
implements ControllerFactory

Title: Expresso Project Description: Copyright: Copyright (c) 2001, 2002, 2003 Company: Jcorporate

Version:
2.0
Author:
Michael Rimov, Extended by Peter Pilgrim, Michael Rimov, Peter Pilgrim, Portions created by the Struts development team
See Also:
ExpressoPlugin, ExpressoRequestProcessor, Serialized Form

Field Summary
protected  Map mapModuleConfig
           
 
Fields inherited from class org.apache.struts.action.ActionServlet
config, configDigester, convertNull, dataSources, debug, internal, internalName, log, processor, registrations, servletMapping, servletName
 
Constructor Summary
ExpressoActionServlet()
          Default constructor
 
Method Summary
 void destroy()
          Remove myself as a controller factory
 Controller getController(ControllerRequest request)
          This method is similar to getController(className) except that it may try to route the construction call to the appropriate controlling servlet
 Controller getController(String className)
          Struts compatible version of the controller factory.
 Controller getController(String moduleName, String className)
          Struts compatible version of the controller factory.
 void init()
          Initialization Code
protected  org.apache.struts.config.ModuleConfig initExpressoFromConfigDirectory(String prefix, String paths)
          Initialize the configuration based upon the context ConfigDir parameter typical in the older style Expresso [pre 6 :)]
protected  void initExpressoSubapplication(String prefix, org.apache.struts.config.ModuleConfig config, String configPath)
          Initialise Expresso sub application, merge the separate configuration into suppliced Struts config XML, normally default.
protected  org.apache.struts.config.ModuleConfig initModuleConfig(String prefix, String paths)
          Initialize the application configuration information for the specified module.
protected  void loadOneConfigFile(org.apache.commons.digester.Digester digester, org.xml.sax.InputSource is)
          Load one configuration file
 
Methods inherited from class org.apache.struts.action.ActionServlet
addServletMapping, destroyApplications, destroyConfigDigester, destroyDataSources, destroyInternal, destroyModules, doGet, doPost, findDataSource, findFormBean, findForward, findMapping, getApplicationConfig, getDebug, getInternal, getModuleConfig, getRequestProcessor, getResources, initApplicationConfig, initApplicationDataSources, initApplicationMessageResources, initApplicationPlugIns, initConfigDigester, initDataSources, initInternal, initModuleDataSources, initModuleMessageResources, initModulePlugIns, initOther, initServlet, log, process
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapModuleConfig

protected Map mapModuleConfig
Constructor Detail

ExpressoActionServlet

public ExpressoActionServlet()
Default constructor

Method Detail

initModuleConfig

protected org.apache.struts.config.ModuleConfig initModuleConfig(String prefix,
                                                                 String paths)
                                                          throws ServletException

Initialize the application configuration information for the specified module.

Additional notes by Peter Pilgrim Sun Feb 16 13:53:07 GMT 2003

We require the interception of the implementation of the ActionServlet.initModuleConfig method in�this class, because we need to keep a record of all the defined modules and their configurations. It makes easy to implement controller factory interface.

Parameters:
prefix - Module prefix for this module
paths - Comma-separated list of context-relative resource path(s) for this modules's configuration resource(s)
Returns:
Constructed Module Config
Throws:
ServletException - if initialization cannot be performed
Since:
Struts 1.1

initExpressoFromConfigDirectory

protected org.apache.struts.config.ModuleConfig initExpressoFromConfigDirectory(String prefix,
                                                                                String paths)
                                                                         throws ServletException
Initialize the configuration based upon the context ConfigDir parameter typical in the older style Expresso [pre 6 :)]

Parameters:
prefix - the prefix for the module
paths - the Module config to add to
Returns:
true if succesfully initialized from config directory, false otherwize, indicating that the configuration system should continue and try to load from the classpath.
Throws:
ServletException - upon error

loadOneConfigFile

protected void loadOneConfigFile(org.apache.commons.digester.Digester digester,
                                 org.xml.sax.InputSource is)
                          throws ServletException
Load one configuration file

Parameters:
digester - the digester to parse
is - the input source to parse
Throws:
ServletException - upon error

initExpressoSubapplication

protected void initExpressoSubapplication(String prefix,
                                          org.apache.struts.config.ModuleConfig config,
                                          String configPath)
                                   throws ServletException
Initialise Expresso sub application, merge the separate configuration into suppliced Struts config XML, normally default.

Parameters:
prefix - the sub application prefix
config - the module configuration
configPath - the module path to load to
Throws:
ServletException - upon error

getController

public Controller getController(String className)
                         throws ControllerException
Struts compatible version of the controller factory. Adds the created class to the actions list if it doesn't exist already.

Specified by:
getController in interface ControllerFactory
Parameters:
className - The className of the controller to get/instantiate
Returns:
an instantiated Controller object
Throws:
ControllerException - upon error

getController

public Controller getController(String moduleName,
                                String className)
                         throws ControllerException
Struts compatible version of the controller factory. Adds the created class to the actions list if it doesn't exist already.

Specified by:
getController in interface ControllerFactory
Parameters:
moduleName - The Struts 1.1 module name
className - The className of the controller to get/instantiate
Returns:
an instantiated Controller object
Throws:
ControllerException - upon error

getController

public Controller getController(ControllerRequest request)
                         throws ControllerException
This method is similar to getController(className) except that it may try to route the construction call to the appropriate controlling servlet

Specified by:
getController in interface ControllerFactory
Parameters:
request - The ControllerRequest that has all the parameters we need to construct the appropriate controller.
Returns:
an instantiated Controller object
Throws:
ControllerException - if there's an error instantiating the controller

init

public void init()
          throws ServletException
Initialization Code

Throws:
ServletException - upon error

destroy

public void destroy()
Remove myself as a controller factory

Specified by:
destroy in interface Servlet

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.