wow that was a terrific explanation. Thanks Don!
[note: I was not the original poster]

Brad Cupit
Louisiana State University - UIS
e-mail: [EMAIL PROTECTED]
office: 225.578.4774


-----Original Message-----
From: Don Brown [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 14, 2008 10:13 AM
To: Struts Users Mailing List
Subject: Re: [S2] Spring: Interceptors, prototype or singleton?

To clarify, interceptors aren't technically singletons as each
instance in an interceptor stack gets its own interceptor instance.
However, for all requests using that stack, the same interceptor will
be used.  Therefore, you do need to be careful.  For example, most
interceptors take parameters that configure their use within the
stack, like the "validation" interceptor that takes a list of excluded
methods from validation.  Interceptors can be configured at the stack
level or at the action level.  If at the action level, you will get a
unique interceptor instance for that action.

If you want Spring to construct your interceptor, I recommend the
prototype scope, so that Struts gets a new instance of the interceptor
as expected.

Don

On Tue, Apr 15, 2008 at 12:48 AM, Randy Burgess <[EMAIL PROTECTED]>
wrote:
> Interceptors are Singletons according to the documentation. If it were
me I
>  would come up with another method besides Spring for changing object
>  properties.
>
>  Regards,
>  Randy Burgess
>  Sr. Web Applications Developer
>  Nuvox Communications
>
>
>
>  > From: GF <[EMAIL PROTECTED]>
>  > Reply-To: Struts Users Mailing List <user@struts.apache.org>
>  > Date: Mon, 14 Apr 2008 14:51:25 +0200
>  > To: Struts Users ML <user@struts.apache.org>
>  > Subject: [S2] Spring: Interceptors, prototype or singleton?
>
>
> >
>  > In a guide I found on the web, the interceptor was defined as
singleton in
>  > the Spring's ApplicationContext.
>  >
>  > If I need to use "changeable" object properties, I need to have it
as
>  > Prototype, otherwise different requests will result in a object
property
>  > overwriting.
>  > Is there any issues about defining an interceptor as Prototype, or
is it ok?
>  >
>  > Thanks
>  >
>  > GF
>
>
>
>  This email and any attachments ("Message") may contain legally
privileged and/or confidential information.  If you are not the
addressee, or if this Message has been addressed to you in error, you
are not authorized to read, copy, or distribute it, and we ask that you
please delete it (including all copies) and notify the sender by return
email.  Delivery of this Message to any person other than the intended
recipient(s) shall not be deemed a waiver of confidentiality and/or a
privilege.
>
>
>  This email and any attachments ("Message") may contain legally
privileged and/or confidential information.  If you are not the
addressee, or if this Message has been addressed to you in error, you
are not authorized to read, copy, or distribute it, and we ask that you
please delete it (including all copies) and notify the sender by return
email.  Delivery of this Message to any person other than the intended
recipient(s) shall not be deemed a waiver of confidentiality and/or a
privilege.
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to