AutoRegisterActionServlet Class

com.bea.wlw.netui.pageflow
AutoRegisterActionServlet Class

public class AutoRegisterActionServlet

    extends ActionServlet

ActionServlet that dynamically registers requested modules based on registered module configuration file locators. The user may specify AutoRegisterActionServlet.ModuleConfigLocator classes in web.xml, using the "moduleConfigLocators" init-parameter; this allows the user to define patterns for auto-registered Struts modules.


Hierarchy
Object
  GenericServlet
    HttpServlet
      ActionServlet
        AutoRegisterActionServlet
All Implemented Interfaces

Serializable, Servlet, ServletConfig
Direct Known Subclasses

PageFlowActionServlet

Nested Class Summary

public static interfaceAutoRegisterActionServlet.ModuleConfigLocator
           Interface for specifying alternate locations for auto-registered Struts modules.

Field Summary

public static String
MODULE_CONFIG_LOCATOR_CLASS_ATTR
String
   
Fields from  org.apache.struts.action.ActionServlet
config, configDigester, convertNull, dataSources, debug, internal, internalName, log, processor, registrations, servletMapping, servletName
 

Constructor Summary

AutoRegisterActionServlet()

 

Method Summary

public void
destroy()
protected AutoRegisterActionServlet.ModuleConfigLocator[]
getDefaultModuleConfigLocators()
Get the base list of ModuleConfigLocators, to specify locations for auto-registered Struts modules.
public String
getInitParameter(String s)
public Enumeration
getInitParameterNames()
protected ModuleConfig
getModuleConfig(String modulePath, ServletRequest request, ServletResponse response)
Get the Struts ModuleConfig for the given module path.
protected AutoRegisterActionServlet.ModuleConfigLocator[]
getModuleConfigLocators()
Get the current list of registered ModuleConfigLocators.
public String
getModuleConfPath(String modulePath)
Get the webapp-relative path to the Struts module configration file for a given module path, based on registered ModuleConfigLocators.
public void
init()
Initialize the servlet.
public void
init(ServletConfig config)
protected void
process(HttpServletRequest request, HttpServletResponse response)
This override of the base class process() registers a Struts module on the fly if the config file can be found in our standard place (named in our standard way), regardless of whether the module is configured in web.xml.
protected synchronized ModuleConfig
registerModule(String modulePath, String configFilePath)
Register a Struts module, initialized by the given configuration file.
 
Methods from  org.apache.struts.action.ActionServlet
addServletMapping, destroyApplications, destroyConfigDigester, destroyInternal, destroyModules, doGet, doPost, findDataSource, findFormBean, findForward, findMapping, getApplicationConfig, getDebug, getInternal, getModuleConfig, getRequestProcessor, getResources, initApplicationConfig, initApplicationDataSources, initApplicationMessageResources, initApplicationPlugIns, initDataSources, initInternal, initModuleMessageResources, initModulePlugIns, initOther, initServlet, log,
 
Methods from  javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods from  javax.servlet.GenericServlet
destroy, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log, service
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   
Methods from interface javax.servlet.Servlet
destroy, getServletConfig, getServletInfo, init, service
 
Methods from interface javax.servlet.ServletConfig
getInitParameter, getInitParameterNames, getServletContext, getServletName
 

Field Detail

MODULE_CONFIG_LOCATOR_CLASS_ATTR

public static String MODULE_CONFIG_LOCATOR_CLASS_ATTR

 

Constructor Detail

AutoRegisterActionServlet

public AutoRegisterActionServlet()
 

Method Detail

destroy() Method

public void destroy()
Overrides
ActionServlet.destroy()

getDefaultModuleConfigLocators() Method

protected AutoRegisterActionServlet.ModuleConfigLocator[] getDefaultModuleConfigLocators()
Get the base list of ModuleConfigLocators, to specify locations for auto-registered Struts modules. By default, this list is empty; derived classes may override to provide locators, or the user may specify them using the "moduleConfigLocators" init-parameter. When an unrecognized Struts module is requested, each registered ModuleConfigLocator is queried for a possible path to the configuration file for the module. If the configuration file is found, the module is auto-registered against the file.


getInitParameter(String) Method

public String getInitParameter(String s)
Overrides
GenericServlet.getInitParameter(String)

getInitParameterNames() Method

public Enumeration getInitParameterNames()
Overrides
GenericServlet.getInitParameterNames()

getModuleConfig(String, ServletRequest, ServletResponse) Method

protected ModuleConfig getModuleConfig(String modulePath, 
                                       ServletRequest request, 
                                       ServletResponse response)
throws IOException, ServletException
Get the Struts ModuleConfig for the given module path.

Parameters

modulePath
the module path, from the request URI.
request
the current ServletRequest
response
the current HttpServletResponse

Returns

the Struts ModuleConfig that corresponds with modulePath

Exceptions

IOException
ServletException

getModuleConfigLocators() Method

protected AutoRegisterActionServlet.ModuleConfigLocator[] getModuleConfigLocators()
Get the current list of registered ModuleConfigLocators.

Returns

an array of registered ModuleConfigLocators.

Related Topics

AutoRegisterActionServlet.getDefaultModuleConfigLocators()


getModuleConfPath(String) Method

public String getModuleConfPath(String modulePath)
Get the webapp-relative path to the Struts module configration file for a given module path, based on registered ModuleConfigLocators.

Parameters

modulePath
the Struts module path.

Returns

a String that is the path to the Struts configuration file, relative to the web application root, or null if no appropriate configuration file is found.

Related Topics

AutoRegisterActionServlet.getDefaultModuleConfigLocators()


init() Method

public void init()
throws ServletException
Initialize the servlet.

Overrides
ActionServlet.init()

Exceptions

ServletException

init(ServletConfig) Method

public void init(ServletConfig config)
throws ServletException
Overrides
GenericServlet.init(ServletConfig)

Exceptions

ServletException

process(HttpServletRequest, HttpServletResponse) Method

protected void process(HttpServletRequest request, 
                       HttpServletResponse response)
throws IOException, ServletException
This override of the base class process() registers a Struts module on the fly if the config file can be found in our standard place (named in our standard way), regardless of whether the module is configured in web.xml.

Overrides
ActionServlet.process(HttpServletRequest, HttpServletResponse)

Exceptions

IOException
ServletException

registerModule(String, String) Method

protected synchronized ModuleConfig registerModule(String modulePath, 
                                                   String configFilePath)
throws ServletException
Register a Struts module, initialized by the given configuration file.

Parameters

modulePath
the module path, starting at the webapp root, e.g., "/info/help".
configFilePath
the path, starting at the webapp root, to the module configuration file (e.g., "/WEB-INF/my-generated-struts-config-info-help.xml").

Returns

the Struts ModuleConfig that was initialized.

Exceptions

ServletException