For the complete documentation index, see llms.txt. This page is also available as Markdown.

Request Lifecycle

How ColdBox works — the front controller, request context, and the full request lifecycle.

ColdBox uses both implicit and explicit invocation to execute events and render content. You configure your entire application from a single class — config/ColdBox.bx (or .cfc for CFML) — plus a set of folder and file conventions.

Remember: this framework will not solve all your problems. It is a standard and a foundation to develop on. It is up to you to create GOOD code — the framework helps, but the responsibility is yours.

The Front Controller

Every request enters through a single template — index.bxm (or .cfm) — which boots ColdBox via the Application.bx (or .cfc) bootstrap. This is the Front Controller pattern: one entry point that parses the request and dispatches it to the right event handler.

The Request Context

Incoming URL, FORM, and REMOTE variables merge into a single structure — the request collection (RC) — stored in an object called the Request Context. A second collection, the private request collection (PRC), cannot be affected by the outside world; use it for internal request state.

The request context is your information superhighway for the request: getting and setting values between MVC layers, request metadata, RESTful rendering, HTTP headers, and more. See Request Context and the API Docs.

A Typical Request

For http://www.example.com/index.bxm?event=home.about:

  1. The request context is created; FORM/URL scopes populate the request collection

  2. The event is determined from the event variable: handler home, action about (note the period separator)

  3. The about() method runs in handlers/home.bx (or .cfc)

  4. The handler may call models for business logic

  5. The view set in the event renders (views/home/about.bxm, or .cfm)

  6. The view's HTML is wrapped in the layout (layouts/main.bxm, or .cfm)

  7. The page returns to the browser

With SES routing enabled (the default), the same request is usually http://www.example.com/home/about — see Routing.

Beyond MVC Requests

ColdBox also dispatches:

  • Routes — pretty URLs resolved by the Router before event lookup

  • Proxy calls — remote/SOAP-style access via the ColdBox Proxy

  • Interceptions — framework and custom events announced through the lifecycle via Interceptors

See Also

Last updated

Was this helpful?