<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:[EMAIL PROTECTED]
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:[EMAIL PROTECTED]
Sent: Thursday, July 08, 2004 5:54 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
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:[EMAIL PROTECTED]
> 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:[EMAIL PROTECTED]
> Sent: Thursday, 8 July 2004 19:56
> To: Struts Users Mailing List; [EMAIL PROTECTED]
> 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: [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