org.apache.beehive.netui.pageflow
Class PageFlowActionServlet

Object
  extended by GenericServlet
      extended by HttpServlet
          extended by ActionServlet
              extended by AutoRegisterActionServlet
                  extended by PageFlowActionServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig
Direct Known Subclasses:
DynamicSubappActionServlet

public class PageFlowActionServlet
extends AutoRegisterActionServlet

ActionServlet that dynamically registers modules based on naming/location conventions for Struts configuration files that are generated by the Page Flow compiler. These files are located in /WEB-INF/classes/_pageflow, and are named struts-config-module-name.xml. For auto-registration of config files in other locations, the user may specify additional PageFlowActionServlet.DefaultModuleConfigLocator classes in /WEB-INF/beehive-netui-config.xml using the <module-config-locators> element.

See Also:
Serialized Form

Nested Class Summary
static class PageFlowActionServlet.DefaultModuleConfigLocator
          Default ModuleConfigLocator that looks for Struts module configuration files according to the pattern "/WEB-INF/classes/_pageflow/struts-config-<module>".
protected static class PageFlowActionServlet.LegacyModuleConfigLocator
          ModuleConfigLocator that looks for legacy Struts module configuration files according to the pattern "/WEB-INF/struts-config-<module>".
 
Nested classes/interfaces inherited from class AutoRegisterActionServlet
AutoRegisterActionServlet.ModuleConfigLocator
 
Field Summary
 
Fields inherited from class AutoRegisterActionServlet
MODULE_CONFIG_LOCATOR_CLASS_ATTR
 
Fields inherited from class ActionServlet
config, configDigester, convertNull, dataSources, debug, internal, internalName, log, processor, registrations, servletMapping, servletName
 
Constructor Summary
PageFlowActionServlet()
           
 
Method Summary
 void addServletMapping(String servletName, String urlPattern)
          Struts keeps track of the action servlet URL pattern (e.g., *.do) so it can construct action URIs.
protected  AutoRegisterActionServlet.ModuleConfigLocator[] getDefaultModuleConfigLocators()
          Get the base list of ModuleConfigLocators, to specify locations for auto-registered Struts modules.
 String getModuleConfPath(String modulePath)
          Get the webapp-relative path to the Struts module configration file for a given module path.
 void init()
           
protected  boolean moduleCanHandlePath(ModuleConfig moduleConfig, RequestProcessor rp, String servletPath)
          Tell whether the given module can handle the given path.
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  boolean processUnhandledAction(HttpServletRequest request, HttpServletResponse response, String uri)
          Last chance to handle an unhandled action URI.
 
Methods inherited from class AutoRegisterActionServlet
clearRegisteredModules, destroy, ensureModuleRegistered, ensureModuleRegistered, getConfigResource, getConfigResourceAsStream, getInitParameter, getInitParameterNames, getModuleConfig, getModuleConfigLocators, initConfigDigester, initModuleConfig, registerModule
 
Methods inherited from class ActionServlet
destroyApplications, destroyConfigDigester, destroyDataSources, destroyInternal, destroyModules, doGet, doPost, findDataSource, findFormBean, findForward, findMapping, getApplicationConfig, getDebug, getInternal, getModuleConfig, getRequestProcessor, getResources, initApplicationConfig, initApplicationDataSources, initApplicationMessageResources, initApplicationPlugIns, initDataSources, initInternal, initModuleDataSources, initModuleMessageResources, initModulePlugIns, initOther, initServlet, log
 
Methods inherited from class HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class GenericServlet
getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageFlowActionServlet

public PageFlowActionServlet()
Method Detail

getDefaultModuleConfigLocators

protected AutoRegisterActionServlet.ModuleConfigLocator[] getDefaultModuleConfigLocators()
Get the base list of ModuleConfigLocators, to specify locations for auto-registered Struts modules. By default, this ActionServlet auto-registers Struts modules whose configuration files are located at "/WEB-INF/classes/_pageflow/struts-config-<module>". Overriding this method allows alternate locations to be specified. 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.

Overrides:
getDefaultModuleConfigLocators in class AutoRegisterActionServlet

init

public void init()
          throws ServletException
Overrides:
init in class AutoRegisterActionServlet
Throws:
ServletException

process

protected void process(HttpServletRequest request,
                       HttpServletResponse response)
                throws IOException,
                       ServletException
Description copied from class: AutoRegisterActionServlet
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:
process in class AutoRegisterActionServlet
Throws:
IOException
ServletException

getModuleConfPath

public String getModuleConfPath(String modulePath)
Get the webapp-relative path to the Struts module configration file for a given module path. By default, this is "/WEB-INF/classes/_pageflow/struts-config-<module>", but alternate locations can be specified by adding PageFlowActionServlet.DefaultModuleConfigLocators.

Overrides:
getModuleConfPath in class AutoRegisterActionServlet
Parameters:
modulePath - the Struts module path.
Returns:
a String that is the path to the Struts configuration file, relative to the web application root.
See Also:
getDefaultModuleConfigLocators()

addServletMapping

public void addServletMapping(String servletName,
                              String urlPattern)
Struts keeps track of the action servlet URL pattern (e.g., *.do) so it can construct action URIs. We want to prevent it from noticing *.jpf so it doesn't use that to construct the URIs.

Overrides:
addServletMapping in class ActionServlet

moduleCanHandlePath

protected boolean moduleCanHandlePath(ModuleConfig moduleConfig,
                                      RequestProcessor rp,
                                      String servletPath)
Tell whether the given module can handle the given path. If this is the root module (path=="") and it's a Page Flow module, then it shouldn't try to handle any path that has a slash in it -- it only handles local actions.

Overrides:
moduleCanHandlePath in class AutoRegisterActionServlet

processUnhandledAction

protected boolean processUnhandledAction(HttpServletRequest request,
                                         HttpServletResponse response,
                                         String uri)
                                  throws IOException,
                                         ServletException
Last chance to handle an unhandled action URI.

Overrides:
processUnhandledAction in class AutoRegisterActionServlet
Returns:
true if this method handled it (by forwarding somewhere or writing to the response).
Throws:
IOException
ServletException