axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michele Mazzucco <Michele.Mazzu...@ncl.ac.uk>
Subject RE: How to get information at startup of tomcat
Date Thu, 17 May 2007 09:28:04 GMT
Hi Tui,



On Thu, 2007-05-17 at 10:23 +0100, rui.torres@enabler.com wrote:
> Hi Michele,
> 
> Thank you for your help.
> 
> I want to know where I put the init and destroy methods.
> 
You should put those methods into your service class.

> Are these methods only invoked when a startup and a shutdown is done in
> tomcat? Or they are invoked every time my webservice is invoked?

No, only when the service is loaded and unloaded (which can differ from
startup/shutdown).
> 
> Regards,
> 
> Rui Torres


Michele
>  
> 
> -----Original Message-----
> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk] 
> Sent: Wednesday, May 16, 2007 7:38 PM
> To: axis-user@ws.apache.org
> Subject: Re: How to get information at startup of tomcat
> 
> Rui,
> 
> what about the ServiceContext?
> In your service add these two methods (they will be invoked via
> reflection)
> 
> public void init(ServiceContext serviceContext) {
> 	// put your initialization code here
> }
> 
> public void destroy(ServiceContext serviceContext) {
> 	// this code will be executed when the service is unloaded }
> 
> The ServiceContext has a Map where you can store your stuff
> (getProperties(), getProperty(), setProperty()) If you want to access
> your data when you process client requests:
> 
> public OMElement foo(OMElement el) {
> 	ServiceContext sCtx = MessageContext.getCurrentMessageContext
> ().getServiceContext();
> 	// read/write/update your stuff
> 
> 	//process the request
> }
> 
> 
> Michele
> 
> 
> 
> On 16 May 2007, at 19:15, <rui.torres@enabler.com>
> <rui.torres@enabler.com> wrote:
> 
> > Hi all,
> >
> >
> > I am developing a webservice with axis/tomcat, which gets some 
> > information from a database. The problem is that the information is 
> > not modified frequently, and is obtained each time that my webservice 
> > is invoked.
> >
> > I want to know if it is possible to get this information after the 
> > startup of the tomcat, put it somewhere in a structure (it can be in 
> > an object), and then access it inside my classes.
> >
> > Regards,
> >
> > Rui Torres
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 


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


Mime
View raw message