cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@sundn.de>
Subject AW: Why WebApp programming is harder than necessary with C2
Date Thu, 07 Jun 2001 07:06:24 GMT
> Giacomo Pati wrote:
>
> Quoting Carsten Ziegeler <cziegeler@sundn.de>:
>
> > > Giacomo Pati wrote:
> > >
> > > On Wed, 6 Jun 2001, Berin Loritsch wrote:
> > >
> > > > giacomo wrote:
> > > > >
> > > > > On Tue, 5 Jun 2001, Davanum Srinivas wrote:
> > > > >
> > > > > > Giacomo,
> > > > > > Please check if what i checked in is ok.
> > > > >
> > > > > After thinking again we'd better extend the Environment
> > > interface with a
> > > > > method called getRedirector() as replacement for the redirect()
> > method
> > > > > (similar to getOutputStream()) and let the sitemap engine pass
> > that
> > > > > object to the Actions and of course use that for the
> > implementation of
> > > > > the map:redirect element as well. It seams a clearer approach to
> > me so
> > > > > implementors of an Environment are free how to implement a
> > Redirector.
> > >
> > > And here comes another way to do it:
> > >
> > > Let the sitemap have its own Redirector implementation which proxies
> > the
> > > Environments redirect method. This way the Environment interface
> > doesn't
> > > have to be changed and the sitemap can track redirection to break out
> > of
> > > the evaluation loop as it does for <map:redirect uri=.../>
> > >
> > > What do you all think?
> > >
> > Yes, this might be the way to go. We don't have to change interfaces!
> >
> > The current implementation has the problem that the evaluation loop
> > is not exited even when a redirect takes place in an action.
>
> Yes, exactly. This is one of the reasons why only the sitemap
> needs to do the
> redirect. Else new Exception had to be created to report
> redirections to the
> sitemap to have a possibility to break out of the evaluation
> loop. The latest
> proposal takes care of this as the sitemap can interact redirect calls.
>
> > But I am not quite sure how the sitemap can "remember" the state for one
> > single request if it has done a redirect or not.
>
> The redirector implementation known by the sitemap:
>
>    public class SitemapRedirector implements Redirector {
>      private boolean hasRedirected = false;
>      private Environment e;
>      public SitemapRedirector (Environment e) {
>        this.e = e;
>      }
>      public void redirect (String url) {
>        e.redirect(url);
>        this.hasRedirected = true;
>      }
>      protected boolean hasRedirected () {
>        return this.hasRedirected;
>      }
>    }
>
> The generated sitemap engine can create a SitemapRedirector for a
> request and
> pass it to the Actions. Afterwards a call to the hasRedirected
> method will
> indicate if the sitemap engine can break out or not.
>
> > But anyway, the current implementation should be changed as now is
> > assumed that the Environment always implements the Redirector interface
> > which is not true for the command line interface...
>
> Yup. The approach mentioned above will fix it again I think.
>
Ah ok, I see. You create an extra object which gets the state.
Yes, this looks good to me.
So, a +1 for this change.


Carsten

Open Source Group                        sunShine - b:Integrated
================================================================
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
www.sundn.de                          mailto: cziegeler@sundn.de
================================================================

> Giacomo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>


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


Mime
View raw message