struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Cooper" <mart...@apache.org>
Subject Re: [s1] Help to Initialize Commands
Date Thu, 22 Feb 2007 04:06:10 GMT
On 2/21/07, Paul Benedict <pbenedict@apache.org> wrote:
>
> One thing I noticed in s1 is that there is no way to initialize a
> command. I am not speaking about the public constructor, but a way for a
> servlet-aware command to perform first-time initialization before its
> execute() method gets invoked.


You're making the assumption that there *is* such a thing as "first-time
setup". I don't believe that's a safe assumption, and it's certainly not an
assumption that is built into Commons Chain or stated as an invariant
thereof. It's perfectly possible that a command instance is created
immediately before the 'execute' method is invoked and discarded immediately
afterwards. How that works is entirely up to the catalog implementation.

--
Martin Cooper


What should be done? I was thinking of adding a ServletAwareCommand
> interface which a Command can implement to accept the ActionServlet, so
> it can access other pieces of data from the web application. The RP will
> then iterate the chain for these implementors.
>
> Thoughts please? This is the best idea I can think of thus far. Does s2
> do anything alike with its stack?
>
> Paul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message