I didn't like subclassing ActionServlet to manually
initialize the subsystems/extensions for each application,
so I created some classes that allow subsystems/extensions
to be instantiated and initialized based on entries in
the struts-config.xml.  I'm using it for things like
initializing a logging subsystem, database subsystem,
transformations subsystem, etc..

This package consists of two classes:
ExtensionsServlet : ActionServlet subclass w/extensions capability
Extension : Base class for all extensions

The ExtensionsServlet invokes callbacks on the Extension
classes at certain points of its lifecycle, such as
initialization (only one right now).

I'd like to tie this into the event/listener model
enhancement at some point so that an extension could
register to be notified of any event and act upon it.


The following link contains some documentation and the
code:
http://www.rpsenterprises.com/struts/index.html

--Ron S

Struts Extensions
------------------

This package consists of classes supporting struts extensions.
Specifically, the ability to add extensions to the struts framework
via entries in the struts configuration file.

This package contains:
o Class diagram and JavaDocs in HTML format
o Java source code and class files


To use these classes, extend your servlet class from
ExtensionServlet instead of ActionServlet, then update
your struts-config.xml to include any extensions you want
(a dummy sample extension is provided).

Note that the ExtensionServlet turns off digester validation of the
struts-config.xml.  I'll update the struts-config DTD file and
re-package it, then I'll be able to not turn off validation.

To register an extension, insert something like the following to your
struts-config.xml:

...
<struts-config>

  <extensions>
    <extension className="org.strutsx.extensions.DummyExtension"
     configRes="/WEB-INF/someConfig.xml" option1="true">
    </extension>
  </extensions>

... Rest of struts-config


The above creates/registers one extension, and sets two properties of
the extension (configRes & option1).
Note that the <extensions> element must be right below the root
<struts-config> element.


Please let me know if you're using this package or would find something
additional useful.

--Ron

Reply via email to