Applications

Lucee has a concept of "Applications" (as in Web Applications) which provide a context for the code which is running. All code runs within an Application context, and the Lucee runtime provides hooks and settings for controlling the lifecycle of a web application (starting, stopping, requests, responses) and configuration (class paths, databases, clustering, mail settings, and much more)

By default, the Application that code will execute within is defined by all of the settings in the Lucee Admin. However, each code base can define its own Application.cfc Component file. Code bases should always define an Application.cfc

A Basic Application

Any application is defined by simply the presense of an Application.cfc file in the webroot. Consider the following structure:

If running this code, we'll see:

Naming an Application

Its possible for there to be more than one Application.cfc defined for a particular website, or even particular server. Lucee keeps track of Application settings based on providing a unique Application name. Each Application in a server using this name, will have access to the same Application Scope

To name an application, define this.name = "myapp"; in the Application.cfc, like so:

Application Settings

All configurable application settings are defined in the implicit component constructor area along with the Application name. There are many dozens of settings to control all aspects of the Lucee runtime. Below is just an example of a settings, which sets the timezone for the application:

See more details about Application Settings in the Developing Application section.

results matching ""

    No results matching ""