No, rather than changing LookupCommand, you would put your logic into one or more classes that are clean implementations of Command and configure in a catalog with a name so that the existing lookup command would find them -- either put them in catalog "struts" under the name "servlet-standard-preprocess" or change the configuration of the lookup command to find them:
<lookup
catalogName="*your catalog*"
name="*your command name*"
optional="true"/>


You shouldn't need to change the behavior of LookupCommand itself -- you just need to give it the right information to do its job.

As an aside, I think reveals an unfortunate (though minor) shortcoming of the basic chain model: either way, you must edit the struts chain-config.xml in order to use this behavior. I would prefer if there were a way for users to register their preprocessing command without having to extract the chain-config and edit it. That in itself isn't so bad, but it also makes it harder to track future changes in the chain-config.xml as distributed and integrate your local details with newer versions. It almost calls for an AOP-like configuration realm.

Also, to clarify:

And so, I will need to replace this entry in chain-config.xml
<define name= "lookup"
            className= "org.apache.commons.chain.generic.LookupCommand"
/>

with
<define name= "lookup"
            className= "com.myapp.commands.MyLookupCommand" />

This <define> element is just a bit of syntactic sugar that Craig came up with in the chain-config digesting process that allows you to do this once and then later have simpler configuration, say for example if you use a given command frequently. It's comparable to the <taskdef> tag in Ant. But again, the whole intention of the LookupCommand is that instead of changing its behavior, you point it at the other commands which you want executed.


If you changed the behavior of org.apache.commons.chain.generic.LookupCommand, you would impact Struts in each of the places where it has a <lookup> element -- looking up the preprocessing command, looking up the process-action chain, and looking up the process-view chain. That's probably not what you want.

Joe

--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to