At 9:35 PM -0500 1/6/05, Frank W. Zammetti wrote:
Question: Can you dynamically alter the chain sequence on a per-request basis?

Well, the sequence itself is fairly static, although technically you could probably modify the chain catalogs. However, what I think you're actually asking isn't so complicated; you just want to be able to execute the chain differently, or execute different chains based on the state of the request. But commons-chain itself comes with lookup and copy commands which are probably the basis of what you're thinking about trying to do.


I believe that the "servlet-complete" base chain in the current default chain-config.xml is intended to demonstrate some of this kind of possibility. It has a "preprocess" step which optionally looks up and executes a command, and is designed so that it would be pretty easy for that command to change the command which is executed later. I haven't spent a lot of time thinking about trying to set up something like this, but I'm pretty sure you could do it.

Joe



The reason I ask is with regard to my Struts Web Services project... Currently, it uses a custom request processor to recognize a WS request, does some preprocessing and then essentially forwards the request on to itself. At that point it looks just like a normal HTTP Post, so the sequence works just like it would with a normal request processor, that is, the WS request is transparently handled by the rest of the application.

Now, I haven't looked at chains much, but in thinking about how to do something like that... One approach that comes to mind is to have a Command object early on in the chain that recognizes the request as being a WS request or not. Then, it sends the request down one "chain path" for a WS requests, and down another, slightly different one (probably just dropping one or two Command objects from the sequence, the ones corresponding to the preprocessing steps I do now) for a normal request.

Just curious at this point, but your quick writeup here was very informative, so I figured I'd ask :)

--
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