server.cfc

188 views
Skip to first unread message

AJ Mercer

unread,
Jul 14, 2016, 8:45:49 AM7/14/16
to lu...@googlegroups.com
Did server.cfc get implemented in Lucee?

Ff so, please point me to doco.

If not, how do people populate SERVER scope before applications start up?

--

Andrew Dixon

unread,
Jul 14, 2016, 9:01:27 AM7/14/16
to lu...@googlegroups.com
I don't think so, what about using the OnServerStart in the Application.cfc?

Kind regards,

Andrew

--
Win a ticket to dev.objective from Lucee via Twitter, see http://bit.ly/1UbTMWj for details, good luck and see you there...
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/CAPURtC0234Jmp_ScC2HNpZ-8N72f1RPBMit15tJ6Fbkm%2BZk7gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

AJ Mercer

unread,
Jul 14, 2016, 9:05:06 AM7/14/16
to lu...@googlegroups.com
does they fire wen Lucee starts up
or the first time the application is loaded?

I am something that fires when Luce Starts


For more options, visit https://groups.google.com/d/optout.

Andrew Dixon

unread,
Jul 14, 2016, 9:08:48 AM7/14/16
to lu...@googlegroups.com
Never used it, but given the name I would assume it is on server start up, otherwise it is no different to onApplicationStart.

Kind regards,

Andrew

ADK

unread,
Jul 14, 2016, 2:42:05 PM7/14/16
to Lucee
but Application.cfc isn't hit "on server start" so how would that work?

Andrew Dixon

unread,
Jul 14, 2016, 2:52:00 PM7/14/16
to lu...@googlegroups.com
Like I said, I've never used it but it is listed in the Javadoc's for Lucee:


and it says:

onServerStart()
this method will be called when a server starts

There is also onServerEnd:

onServerEnd()
this method will be called when the server shutdown correctly (no crashes)

I guess the only way to find out what it does is try it!!! :-)

Kind regards,

Andrew

Nando Breiter

unread,
Jul 14, 2016, 4:16:44 PM7/14/16
to lu...@googlegroups.com
Here's my test Application.cfc, dropped into a subdirectory under the webroot


component {
this.name = "rename";

public void function onApplicationStart() {
systemOutput('onApplicationStart() called!', true);
}

public void function onRequestStart() {
systemOutput('onRequestStart() called!', true);
}

public void function onServerStart() {
systemOutput('onServerStart() called!', true);
}

public void function onServerEnd() {
systemOutput('onServerEnd() called!', true);
}

}

I'm seeing onApplicationStart() called! and onRequestStart() called! testing on Lucee 5, but no sign at all of the the server start and stop log entries in catalina.out.






Aria Media Sagl
+41 (0)76 303 4477 cell
skype: ariamedia

Andrew Dixon

unread,
Jul 14, 2016, 4:33:44 PM7/14/16
to lu...@googlegroups.com

Gert Franz

unread,
Jul 14, 2016, 6:01:16 PM7/14/16
to lu...@googlegroups.com

Hi all,

 

The latest version of Lucee 5.0.1.024 contains a first implementation of web.cfc and server.cfc. There are a few things that need to be said here:

1.      It’s a hidden feature yet (well not really anymore J)

2.      The server.cfc is loaded BEFORE all web contexts are loaded. This means that there will no application or so be available. Only to fill the server scope for instance or create files etc.

3.      The web.cfc is called for each web context, when it starts. It contains ONE method which will be onWebStart() so the cfc will look like this:

 

component {

 

     public function onWebStart() {

           doSomething…

     }

 

}

 

HTH

 

Sincerely
Gert Franz

 

RASIA GmbH

Spittelgasse 7

5103 Moeriken-Wildegg

Switzerland

Email: ge...@rasia.ch
Skype: gert.franz

Phone Switzerland: +41 76 5680 231

image001.png

Andrew Dixon

unread,
Jul 14, 2016, 6:28:11 PM7/14/16
to lu...@googlegroups.com
Bit more on what Gert has said from my conversation with Micha this evening.

1) The web.cfc goes in the following location /WEB-INF/lucee/context/Web.cfc
2) There is currently no server.cfc, however it is in the works.
3) The web.cfc gets run when the web context starts, so basically on server start, but could vary depending on your app server configuration.
4) This feature is completely experimental, not deeply tested and could change, so use with caution.

Hope that is helpful.

Kind regards,

Andrew

AJ Mercer

unread,
Jul 14, 2016, 7:50:01 PM7/14/16
to lu...@googlegroups.com
Thanks Gert, Andrew and Micha.

I am pretty sure I have mentioned it before, but - Team Lucee Rock

To the Devatorium everybody!

For more options, visit https://groups.google.com/d/optout.

Michael Offner

unread,
Jul 15, 2016, 2:24:09 AM7/15/16
to lucee
Small addition, the Web.cfc is also called when you restart a webcontext, that means also a change in the admin can trigger a restart of a context (this behaviour may change).

 component {
  public function onWebStart(required boolean reload) {
  systemOutput("susi sorglos",true);
  }
 }

Micha

AJ Mercer

unread,
Jul 15, 2016, 11:40:33 PM7/15/16
to lu...@googlegroups.com
Is there a ticket or something to watch ( / vote) for server.cfc?

I have added web.cfc - that does not get fired until the web app is access; which seems reasonable enough.

AJ Mercer

unread,
Jul 16, 2016, 12:12:27 AM7/16/16
to lu...@googlegroups.com
Actually, web.cfc fires when server started
but not on a lucee restart (from with in server admin)
Reply all
Reply to author
Forward
0 new messages