struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Husted <ted.hus...@gmail.com>
Subject Re: Spring and XWork in Ti
Date Thu, 01 Sep 2005 17:46:02 GMT
On 9/1/05, Don Brown <mrdon@twdata.org> wrote:
>In that case, I find interceptors more practical, as they allow
> you to have code before and after processing that uses method variables.  With
> Chain, you have to use a Filter and even then, there is no way to share
> variables between the two blocks of code without instance variables which has
> its own problems.

First, you're doing the work, Don, and so you're welcome to make the
decisions :)

Though, I don't understand is why you'd want to be restricted to two
blocks of code :)

With Chain, any number of blocks of code, be they commands or chains,
in any combination, can be the object of the request processing.

In OverDrive/Nexus, we do find having interceptors that surround each
request useful. It's not hard to define "pre" and "post" chains, and
then at runtime create a third chain to execute them all.

		public void ExecuteView (IRequestContext context)
		{
			IRequestCommand command = VerifyRequest (context);
			if (context.IsNominal)
			{
				IChain chain = new Chain ();
				if (_PreOp!=null) chain.AddCommand (_PreOp);
				chain.AddCommand (command);
				if (_PostOp!=null) chain.AddCommand (_PostOp);
				try
				{
					chain.Execute (context);
				}
				catch (Exception e)
				{
					context.Fault = e;
				}
			}
		}

http://svn.apache.org/viewcvs.cgi/struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Catalog.cs?view=markup

The PreOp and PostOp chains are defined in the configuration, along
with everything else.

But, we're not trying to solve the problems of navigational workflows,
only the problem of processing business use cases and interacting with
a presentation layer

-Ted.,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message