At 3:32 PM -0800 12/16/04, Julian wrote:
Hi,

ok, I've been looking at the struts-chain stuff and
have been trying to figure out how to do sub-chains.
The reason I wanted to do this was b/c I thought one
had to start from the servlet-standard chain example
in the SVN repository and insert more commands (or
copy the whole to start a new chain).  I know believe
that it is only nec. if I want legacy support.
However there is another request processor that would
let me define my own chains from scratch that don't
include all the steps in the "servlet-standard" chain.
 For example:
<chain name="test">
     <command className="test.ThisIsStep1"
catalogName="struts" name="step1"/>
     <command className="test.ThisIsStep2"
catalogName="struts" name="step2" />
</chain>

So, I don't need ValidateActionForm, ExecuteAction, or
any other commands in my chain (from SVN
chain-config.xml), right?  And the above chain will
work perfectly fine.

Your above chain will work perfectly fine, once it gets invoked. The way the current config is set up, you could implement a preprocessing chain (servlet-complete-preprocess) which used its own logic to put a different command into the context under the key "requestProcessor."


    <command className="com.example.MyRequestPatternCopyCommand"
        pattern="/test.*"
        toKey="requestProcessor"
        catalogName="struts"
        commandName="step1"/>

The code for this command would work like this:
if (requestURI.matches(pattern)) {
Command cmd = CatalogFactory.getCatalog(this.catalogName).getCommand(this.commandName);


  context.put(this.toKey, cmd);
}
return false;

Does that make sense? If this turned out to be a popular approach, later we might establish some config mechanism so that the mapping of patterns to chains was in its own config file and a single command handled all the testing, but while people are feeling things out, it's pretty straightforward to do something like this.

Also, what significance does the
catalogName attribute have in the command tag?  Are
there any docs on struts-chain?

As suggested by the pseudocode above, the CatalogFactory class has two static methods: one to get a named catalog, and another to get the "default" catalog. This is just to make it more straightforward to have a number of catalogs of commands co-exist. For Struts, the idea right now is that you'd use a servlet init-parameter to define a list of chain-config.xml files, and each one would be read in to populate the environment's collection of catalogs.


The only struts-chain doc right now is the JavaDoc. Obviously, documenting it better will be crucial to integrating it in Struts 1.3.x. Help with this will be very gratefully accepted!

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