You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by gr...@intellicare.com on 2005/10/05 20:20:28 UTC

[Shale] What is the Shale equivalent of the Struts plugin?

Sorry if this is a repeat question - I think it has been asked and 
answered, but I'm drawing a blank with google and the archives.... 

In my Struts apps, if I needed to initialise say an application-wide 
static collection or something I used to implement 
org.apache.struts.action.Plugin. I'd like to know if something parallel 
exists for Shale..?  (Btw, I know I can use a servlet and so forth..)

Many thanks in advance,
Geeta

[OT] Re: [Shale] What is the Shale equivalent of the Struts plugin?

Posted by gr...@intellicare.com.
Hubert Rabago <hr...@gmail.com> wrote on 10/05/2005 03:48:06 PM:

> On 10/5/05, gramani@intellicare.com <gr...@intellicare.com> wrote:
> > Thank you Craig. Every time I read one of your notes it hits me how 
much I
> > should know that i don't.... (:(
> > Geeta
> 
> Don't feel too bad, Geeta.  That's Craig.  Not everyone can have the
> servlet spec pasted on the inside of their eyeballs [1].  :D
> 
> Hubert
> 
> [1] http://jakarta.apache.org/site/contributing.html


.. and that was close to full five years ago! don't know if i want to 
speculate how much his eyeballs must have grown..! ;)

Re: [Shale] What is the Shale equivalent of the Struts plugin?

Posted by Hubert Rabago <hr...@gmail.com>.
On 10/5/05, gramani@intellicare.com <gr...@intellicare.com> wrote:
> Thank you Craig. Every time I read one of your notes it hits me how much I
> should know that i don't.... (:(
> Geeta

Don't feel too bad, Geeta.  That's Craig.  Not everyone can have the
servlet spec pasted on the inside of their eyeballs [1].  :D

Hubert

[1] http://jakarta.apache.org/site/contributing.html


> craigmcc@gmail.com wrote on 10/05/2005 03:01:01 PM:
> >
> >
> > A listener is the right answer to meeting this need. As to the second
> > question, consider a little bit of history for a moment. Why does Struts
> > have a plugin architecture in the first place? The answer is that
> > Struts 1.xwas originally designed to run on top of Servlet
> > 2.2, which does not have listeners (or even filters). Yet, it was clear
> that
> > application startup and shutdown events were a usefu thing to have.
> >
> > (Technically, plugins actually have a risk that listeners don't that you
> > should be aware of. They are implemented by being called from the init()
> and
> > destroy() methods of ActionServlet. The risk is that a servlet container
> is
> > perfectly free to take an already initialized servlet out of service,
> > causing the shutdown listeners to be called, even if the application is
> > still deployed -- which means you might end up paying the initialization
> > price again on the next request to that servlet. The
> ServletContextListener
> > is guaranteed to be called once at app startup time, and once at app
> > shutdown time, only.)
> >
> > Further, there is more than just ServletContextListener (the equivalent
> of a
> > Struts PlugIn) available. Consider listeners that implement the
> following:
> >
> > * ServletContextAttributeListener - you get notified any time an
> application
> > scope attribute is added, replaced, or removed
> >
> > * HttpSessionListener - you get notified when sessions are created or
> > destroyed
> >
> > * HttpSessionAttributeListener - you get notified when a session scope
> > attribute is added, replaced, or removed
> >
> > * ServletRequestListener - you get notified when a request starts or
> stops
> >
> > * ServletRequestAttributeListener - you get notified when a request
> scope
> > attribute is added, replaced, or removed
> >
> >
> > Craig
> >

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


Re: [Shale] What is the Shale equivalent of the Struts plugin?

Posted by gr...@intellicare.com.
Thank you Craig. Every time I read one of your notes it hits me how much I 
should know that i don't.... (:(
Geeta

craigmcc@gmail.com wrote on 10/05/2005 03:01:01 PM:

> On 10/5/05, gramani@intellicare.com <gr...@intellicare.com> wrote:
> >
> > Hubert Rabago <hr...@gmail.com> wrote on 10/05/2005 02:27:59 PM:
> >
> > > For your case, initializing an app-wide collection, consider using a
> > > ServletContextListener. Even in Struts, this would be recommended 
for
> > > containers that support it.
> >
> > oh ok I actually know how to do that..;)) Btw, is there some secret 
reason
> > why a listener is better than a plugin..? :)
> 
> 
> A listener is the right answer to meeting this need. As to the second
> question, consider a little bit of history for a moment. Why does Struts
> have a plugin architecture in the first place? The answer is that
> Struts 1.xwas originally designed to run on top of Servlet
> 2.2, which does not have listeners (or even filters). Yet, it was clear 
that
> application startup and shutdown events were a usefu thing to have.
> 
> (Technically, plugins actually have a risk that listeners don't that you
> should be aware of. They are implemented by being called from the init() 
and
> destroy() methods of ActionServlet. The risk is that a servlet container 
is
> perfectly free to take an already initialized servlet out of service,
> causing the shutdown listeners to be called, even if the application is
> still deployed -- which means you might end up paying the initialization
> price again on the next request to that servlet. The 
ServletContextListener
> is guaranteed to be called once at app startup time, and once at app
> shutdown time, only.)
> 
> Further, there is more than just ServletContextListener (the equivalent 
of a
> Struts PlugIn) available. Consider listeners that implement the 
following:
> 
> * ServletContextAttributeListener - you get notified any time an 
application
> scope attribute is added, replaced, or removed
> 
> * HttpSessionListener - you get notified when sessions are created or
> destroyed
> 
> * HttpSessionAttributeListener - you get notified when a session scope
> attribute is added, replaced, or removed
> 
> * ServletRequestListener - you get notified when a request starts or 
stops
> 
> * ServletRequestAttributeListener - you get notified when a request 
scope
> attribute is added, replaced, or removed
> 
> >
> > > Hubert
> > >
> > > (Can this count as my first answer to a [shale] question? No? Aww.)
> >
> > Thanks! (and if you answer this question too, it counts...;))
> > Geeta
> >
> >
> There's another message that I'd like to get across here as well. One of 
the
> key reasons that Shale is so small is that it does *not* try to 
redundantly
> implement features supported by the base platform. That's why there is 
no
> "Shale PlugIn" or "Shale Container Managed Security" or things like 
that.
> The underlying platform facilities work just fine, and are recommended 
for
> use.
> 
> Craig
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 

> 
> CONFIDENTIALITY NOTICE:This email is intended solely for the person 
> or entity to which it is addressed and may contain confidential 
> and/or protected health information.  Any duplication, 
> dissemination, action taken in reliance upon, or other use of this 
> information by persons or entities other than the intended recipient
> is prohibited and may violate applicable laws.  If this email has 
> been received in error, please notify the sender and delete the 
> information from your system.  The views expressed in this email are
> those of the sender and may not necessarily represent the views of 
> IntelliCare.

Re: [Shale] What is the Shale equivalent of the Struts plugin?

Posted by Craig McClanahan <cr...@apache.org>.
On 10/5/05, gramani@intellicare.com <gr...@intellicare.com> wrote:
>
> Hubert Rabago <hr...@gmail.com> wrote on 10/05/2005 02:27:59 PM:
>
> > For your case, initializing an app-wide collection, consider using a
> > ServletContextListener. Even in Struts, this would be recommended for
> > containers that support it.
>
> oh ok I actually know how to do that..;)) Btw, is there some secret reason
> why a listener is better than a plugin..? :)


A listener is the right answer to meeting this need. As to the second
question, consider a little bit of history for a moment. Why does Struts
have a plugin architecture in the first place? The answer is that
Struts 1.xwas originally designed to run on top of Servlet
2.2, which does not have listeners (or even filters). Yet, it was clear that
application startup and shutdown events were a usefu thing to have.

(Technically, plugins actually have a risk that listeners don't that you
should be aware of. They are implemented by being called from the init() and
destroy() methods of ActionServlet. The risk is that a servlet container is
perfectly free to take an already initialized servlet out of service,
causing the shutdown listeners to be called, even if the application is
still deployed -- which means you might end up paying the initialization
price again on the next request to that servlet. The ServletContextListener
is guaranteed to be called once at app startup time, and once at app
shutdown time, only.)

Further, there is more than just ServletContextListener (the equivalent of a
Struts PlugIn) available. Consider listeners that implement the following:

* ServletContextAttributeListener - you get notified any time an application
scope attribute is added, replaced, or removed

* HttpSessionListener - you get notified when sessions are created or
destroyed

* HttpSessionAttributeListener - you get notified when a session scope
attribute is added, replaced, or removed

* ServletRequestListener - you get notified when a request starts or stops

* ServletRequestAttributeListener - you get notified when a request scope
attribute is added, replaced, or removed

>
> > Hubert
> >
> > (Can this count as my first answer to a [shale] question? No? Aww.)
>
> Thanks! (and if you answer this question too, it counts...;))
> Geeta
>
>
There's another message that I'd like to get across here as well. One of the
key reasons that Shale is so small is that it does *not* try to redundantly
implement features supported by the base platform. That's why there is no
"Shale PlugIn" or "Shale Container Managed Security" or things like that.
The underlying platform facilities work just fine, and are recommended for
use.

Craig

Re: [Shale] What is the Shale equivalent of the Struts plugin?

Posted by gr...@intellicare.com.
Hubert Rabago <hr...@gmail.com> wrote on 10/05/2005 02:35:53 PM:

> On 10/5/05, gramani@intellicare.com <gr...@intellicare.com> wrote:
> >
> > oh ok I actually know how to do that..;)) Btw, is there some secret 
reason
> > why a listener is better than a plugin..? :)
> 
> Yes, and this situation illustrates it.  If you started with a
> listener, you'd be able to carry it over to your new architecture
> which doesn't even use Struts [classic] -- no Struts dependencies is
> the reason.

omg, shoot me. I should have thought of that..!

> 
> > > (Can this count as my first answer to a [shale] question?  No? Aww.)
> >
> > Thanks! (and if you answer this question too, it counts...;))
> > Geeta
> 
> Cool!
> 
> Hubert

Thanks again!
Geeta

Re: [Shale] What is the Shale equivalent of the Struts plugin?

Posted by Hubert Rabago <hr...@gmail.com>.
On 10/5/05, gramani@intellicare.com <gr...@intellicare.com> wrote:
>
> oh ok I actually know how to do that..;)) Btw, is there some secret reason
> why a listener is better than a plugin..? :)

Yes, and this situation illustrates it.  If you started with a
listener, you'd be able to carry it over to your new architecture
which doesn't even use Struts [classic] -- no Struts dependencies is
the reason.

> > (Can this count as my first answer to a [shale] question?  No?  Aww.)
>
> Thanks! (and if you answer this question too, it counts...;))
> Geeta

Cool!

Hubert

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


Re: [Shale] What is the Shale equivalent of the Struts plugin?

Posted by gr...@intellicare.com.
Hubert Rabago <hr...@gmail.com> wrote on 10/05/2005 02:27:59 PM:

> For your case, initializing an app-wide collection, consider using a
> ServletContextListener.  Even in Struts, this would be recommended for
> containers that support it.

oh ok I actually know how to do that..;)) Btw, is there some secret reason 
why a listener is better than a plugin..? :)

> 
> Hubert
> 
> (Can this count as my first answer to a [shale] question?  No?  Aww.)

Thanks! (and if you answer this question too, it counts...;))
Geeta

Re: [Shale] What is the Shale equivalent of the Struts plugin?

Posted by Hubert Rabago <hr...@gmail.com>.
For your case, initializing an app-wide collection, consider using a
ServletContextListener.  Even in Struts, this would be recommended for
containers that support it.

Hubert

(Can this count as my first answer to a [shale] question?  No?  Aww.)

On 10/5/05, gramani@intellicare.com <gr...@intellicare.com> wrote:
> Sorry if this is a repeat question - I think it has been asked and
> answered, but I'm drawing a blank with google and the archives....
>
> In my Struts apps, if I needed to initialise say an application-wide
> static collection or something I used to implement
> org.apache.struts.action.Plugin. I'd like to know if something parallel
> exists for Shale..?  (Btw, I know I can use a servlet and so forth..)
>
> Many thanks in advance,
> Geeta
>

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