Re: ActionForward: scope of modifications?

2001-02-05 Thread John Raley

Well, in general I'm against making global state modifications easy.  As for
cloning, I'm usually taking an existing ActionForward and adding params to it.
Constructing a new one from an existing one is pretty easy; a clone method
would mostly be a hint not to munge the original!


Martin Cooper wrote:

 Yes, that is correct. It wouldn't hurt to document it, I guess. As far as
 cloning or copying is concerned, is there a real need to do that? I find the
 most common pattern that I use for modifying ActionForward's is when I do
 something like:

 return new ActionForward(myPath, myRedirect);

 Rather than cloning and modifying, I just create a new one with the
 parameters I need. Yes, sometimes one or other parameter comes from an
 existing ActionForward, but to me that still seems easier than cloning and
 modifying.

 Hope this helps.

 --
 Martin Cooper
 Tumbleweed Communications

 - Original Message -
 From: "John Raley" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, January 31, 2001 12:31 PM
 Subject: ActionForward: scope of modifications?

  I didn't do a thorough walk through the source, but it appears that if I
  modify an ActionForward returned from an ActionMapping passed to
  Action.perform I am changing global state in struts.  Is this correct?
  If so, I think this should be in the javadoc for ActionMapping, and
  ActionForward should be cloneable or have a copy constructor.
 
  Thanks,
  John
 




Re: ActionForward: scope of modifications?

2001-02-03 Thread Incze Lajos

On Wed, Jan 31, 2001 at 12:31:00PM -0800, John Raley wrote:
 I didn't do a thorough walk through the source, but it appears that if I
 modify an ActionForward returned from an ActionMapping passed to
 Action.perform I am changing global state in struts.  Is this correct?

Correct. So, you should avoid it. I think you can even get some
synchronization problems, too. At the very moment when you manipulate
a forward it can be just used by another app session. There is an
actions package to manipulate struts config classes runtime
(this is my understanding and I may be wrong).incze



Re: ActionForward: scope of modifications?

2001-02-02 Thread Martin Cooper

Yes, that is correct. It wouldn't hurt to document it, I guess. As far as
cloning or copying is concerned, is there a real need to do that? I find the
most common pattern that I use for modifying ActionForward's is when I do
something like:

return new ActionForward(myPath, myRedirect);

Rather than cloning and modifying, I just create a new one with the
parameters I need. Yes, sometimes one or other parameter comes from an
existing ActionForward, but to me that still seems easier than cloning and
modifying.

Hope this helps.

--
Martin Cooper
Tumbleweed Communications

- Original Message -
From: "John Raley" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 31, 2001 12:31 PM
Subject: ActionForward: scope of modifications?


 I didn't do a thorough walk through the source, but it appears that if I
 modify an ActionForward returned from an ActionMapping passed to
 Action.perform I am changing global state in struts.  Is this correct?
 If so, I think this should be in the javadoc for ActionMapping, and
 ActionForward should be cloneable or have a copy constructor.

 Thanks,
 John