struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hill" <andrew.david.h...@gridnode.com>
Subject RE: application configuration
Date Thu, 08 Jul 2004 12:44:08 GMT
<snip>
Plugin approach has some disadvantages, namely, it gets invoked for all the
HTTP GET / POST requests,
that includes GET issued for things like images, CSS files etc.
</snip>

You are confusing PlugIn with something else! (filters?)

PlugIns are expressely created for the purpose of doing this sort of
application config loading, and are called by the ActionServlet from the
ActionServlets own init() method on application startup. They are not called
in response to requests.

Id be wary about using static blocks for anything involving file access. I
cant give you a good reason for that, but it just seems like a bad idea to
me.

-----Original Message-----
From: Kailash Vasani [mailto:KailashV@quinnox.com]
Sent: Thursday, 8 July 2004 20:45
To: 'Struts Users Mailing List'
Subject: RE: application configuration


Hi Viral & Andrew,

I dont have more information, but assumption is that Viral has some class
whose methods should be
invoked in servlet container startup.

Plugin approach has some disadvantages, namely, it gets invoked for all the
HTTP GET / POST requests,
that includes GET issued for things like images, CSS files etc.

in my opinion, Servlet approach should be fine.

I would go for static block in a servlet class & use that to invoke static
methods on the class.

JVM calls static block after loading class & before invoking
any method, including constructor. This static block gets called exactly
once (assuming that you dont have
class loader related maze :-)

Kailash

-----Original Message-----
From: Geeta Ramani [mailto:gramani@terralink.com]
Sent: Thursday, July 08, 2004 5:54 PM
To: Struts Users Mailing List; andrew.david.hill@gridnode.com
Subject: RE: application configuration


Viral: Look at "Struts Tips" by Ted Husted on the struts home page. I am
pretty certain he discusses this very issue in detail. (I can't seem to get
to that link right now hence cannot verify..)

hth,
Geeta

> -----Original Message-----
> From: Andrew Hill [mailto:andrew.david.hill@gridnode.com]
> Sent: Thursday, July 08, 2004 8:01 AM
> To: Struts
> Subject: RE: application configuration
>
>
> Thats one approach. The other is to use a struts plugin.
> I guess its a matter of taste. My personal preference is for
> plugins but
> either way also can.
>
> -----Original Message-----
> From: Viral_Thakkar [mailto:Viral_Thakkar@infosys.com]
> Sent: Thursday, 8 July 2004 19:56
> To: Struts Users Mailing List; andrew.david.hill@gridnode.com
> Cc: Nilesh Suresh Rajurkar
> Subject: RE: application configuration
>
>

>
> Now I want this class to run as soon as server starts... how
> to achieve
> this ..??
>
> One approach ...to create a servlet and configure it in web.xml with
>     <load-on-startup>1</load-on-startup>
>
> Is this ok...or is there any better approach to do the same thing..?
>
> Regards,

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

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


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


Mime
View raw message