You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sastan <sa...@e-d-o-t.com> on 2005/05/02 21:03:13 UTC

init something once

Hello,

i want to initialize something (e.g. do some work) before the first page
renders. How and where should i do this? Where can i add something to
the application start up?

I'm using 3.0.3.

sastan


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


Re: init something once

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On May 2, 2005, at 9:37 PM, Michael Musson wrote:

> Global was also a little bit of a problem for me because it doesn't
> know the context when it is created.

It can if you override createGlobal on a custom engine implementation  
- you can hand it whatever information you need to.

     Erik


>
> On 5/2/05, Paul Ferraro <pm...@columbia.edu> wrote:
>
>> Not quite - the global object is instantiated along with other engine
>> parts in AbstractEngine.setupForRequest(...). Although, as you  
>> correctly
>> implicated, it is instantiated lazily, i.e. not on application  
>> startup,
>> but on the first request to the application.
>>
>> Paul
>>
>> Erik Hatcher wrote:
>>
>>
>>>
>>> On May 2, 2005, at 5:15 PM, Paul Ferraro wrote:
>>>
>>>
>>>> Other locations that come to mind are: a servlet context listener,
>>>> overriding the init() method of the Tapestry servlet, or the global
>>>> object facility.
>>>>
>>>
>>>
>>> Global, though, will be instantiated on the first call to  
>>> getGlobal()
>>> though, not on startup. Right?
>>>
>>> Erik
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user- 
>>> help@jakarta.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user- 
>> help@jakarta.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


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


Re: init something once

Posted by Michael Musson <mu...@gmail.com>.
Global was also a little bit of a problem for me because it doesn't
know the context when it is created.

On 5/2/05, Paul Ferraro <pm...@columbia.edu> wrote:
> Not quite - the global object is instantiated along with other engine
> parts in AbstractEngine.setupForRequest(...). Although, as you correctly
> implicated, it is instantiated lazily, i.e. not on application startup,
> but on the first request to the application.
> 
> Paul
> 
> Erik Hatcher wrote:
> 
> >
> > On May 2, 2005, at 5:15 PM, Paul Ferraro wrote:
> >
> >> Other locations that come to mind are: a servlet context listener,
> >> overriding the init() method of the Tapestry servlet, or the global
> >> object facility.
> >
> >
> > Global, though, will be instantiated on the first call to getGlobal()
> > though, not on startup. Right?
> >
> > Erik
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

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


Re: init something once

Posted by Paul Ferraro <pm...@columbia.edu>.
Not quite - the global object is instantiated along with other engine 
parts in AbstractEngine.setupForRequest(...). Although, as you correctly 
implicated, it is instantiated lazily, i.e. not on application startup, 
but on the first request to the application.

Paul

Erik Hatcher wrote:

>
> On May 2, 2005, at 5:15 PM, Paul Ferraro wrote:
>
>> Other locations that come to mind are: a servlet context listener, 
>> overriding the init() method of the Tapestry servlet, or the global 
>> object facility.
>
>
> Global, though, will be instantiated on the first call to getGlobal() 
> though, not on startup. Right?
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


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


Re: init something once

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On May 2, 2005, at 5:15 PM, Paul Ferraro wrote:

> Other locations that come to mind are: a servlet context listener,  
> overriding the init() method of the Tapestry servlet, or the global  
> object facility.

Global, though, will be instantiated on the first call to getGlobal()  
though, not on startup.  Right?

     Erik


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


Re: init something once

Posted by Paul Ferraro <pm...@columbia.edu>.
Other locations that come to mind are: a servlet context listener, 
overriding the init() method of the Tapestry servlet, or the global 
object facility.

Paul

Erik Hatcher wrote:

>
> On May 2, 2005, at 3:03 PM, sastan wrote:
>
>> Hello,
>>
>> i want to initialize something (e.g. do some work) before the first  
>> page
>> renders. How and where should i do this? Where can i add something to
>> the application start up?
>>
>> I'm using 3.0.3.
>
>
> You can register an <extension> in .application that initializes  
> right away (see the DTD for the exact flag, don't have it at hand,  
> sorry).
>
> Or you could do it the old fashioned way with a load-on-startup servlet.
>
>     Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


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


Re: init something once

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On May 2, 2005, at 3:03 PM, sastan wrote:

> Hello,
>
> i want to initialize something (e.g. do some work) before the first  
> page
> renders. How and where should i do this? Where can i add something to
> the application start up?
>
> I'm using 3.0.3.

You can register an <extension> in .application that initializes  
right away (see the DTD for the exact flag, don't have it at hand,  
sorry).

Or you could do it the old fashioned way with a load-on-startup servlet.

     Erik


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