David
From: Jeff Robertson <[EMAIL PROTECTED]> Reply-To: "Struts Developers List" <[EMAIL PROTECTED]> To: "Struts-Dev (E-mail)" <[EMAIL PROTECTED]> Subject: declaritively plugging custom code into the processXXX methods? Date: Fri, 21 Mar 2003 11:47:46 -0500
Note: Our application is built using Struts 1.0.2, so we are dealing with the process methods of ActionServlet. However, I think something similar would apply to the RequestProcessor of Struts 1.1.
We found ourselves subclassing ActionServlet to insert custom code into the processPreprocess, processMapping, and processActionPerform methods. While this satisfied the requirements of the application, it was less than ideal from a design point of view because the Servlet class that we were creating had multiple and and mutually unrelated customizations all lumped into it.
The solution to this was to create an ActionServlet that allows custom classes to be specified for methods from web.xml, allowing us to mix and match as we please:
<servlet>
...
<!-- This class implements the MappingProcessor interface, which specifies
a process() method to called from ActionServlet.processPreProcess -->
<init-param>
<param-name>preProcessor</param-name>
<param-value>com.some.class.Name</param-value>
</init-param>
<!-- This class implements the MappingProcessor interface, which specifies
a process() method to called from ActionServlet.processMapping -->
<init-param>
<param-name>mappingProcessor</param-name>
<param-value>com.some.other.class.Name</param-value>
</init-param>
<!-- This class implements the MappingProcessor interface, which specifies
a process() method to called from ActionServlet.processActionPerform -->
<init-param>
<param-name>actionProcessor</param-name>
<param-value>
com.yet.another.class.Name
</param-value>
</init-param>
</servlet>
Is this the kind of thing that would be a generally to the Struts community ? Or am I missing something, and there was already a way (either release or in progress) to accomplish this separation of concerns?
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]