Skip to content

Commit

Permalink
improve md
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Jun 6, 2024
1 parent 5da4bd3 commit 4b1cbf4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
22 changes: 12 additions & 10 deletions docs/recipes/application-context-basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
]
}
-->
# Event Handling in Application.cfc

Lucee provides several event handling functions within `Application.cfc` that can be used to manage different stages and types of requests. Here is an overview of these functions and their usage.

### OnApplicationStart ###
## OnApplicationStart

This method is triggered when the application starts.

Expand All @@ -51,7 +53,7 @@ component {
}
```

### OnSessionStart ###
## OnSessionStart

This method is triggered when a session starts.

Expand All @@ -63,7 +65,7 @@ component {
}
```

### OnRequestStart ###
## OnRequestStart

This method is triggered at the start of each request.

Expand All @@ -75,7 +77,7 @@ component {
}
```

### OnRequest ###
## OnRequest

This method handles the actual request. In Lucee, this function is called even if the target page does not exist physically or is never used.

Expand All @@ -87,7 +89,7 @@ component {
}
```

### OnCFCRequest ###
## OnCFCRequest

Similar to "onRequest", but this function is used to handle remote component calls (HTTP Webservices).

Expand All @@ -99,7 +101,7 @@ component {
}
```

### OnError ###
## OnError

This method is triggered when an uncaught exception occurs in this application context.

Expand All @@ -113,7 +115,7 @@ component {

As arguments you receive the exception (cfcatch block) and the eventName.

### OnAbort ###
## OnAbort

This method is triggered when a request is ended with help of the tag `<cfabort>`.

Expand All @@ -125,7 +127,7 @@ component {
}
```

### OnDebug ###
## OnDebug

This method is triggered when debugging is enabled for this request.

Expand All @@ -137,7 +139,7 @@ component {
}
```

### OnMissingTemplate ###
## OnMissingTemplate

This method is triggered when a requested page was not found and **no function "onRequest" is defined**.

Expand All @@ -149,7 +151,7 @@ component {
}
```

## Application.cfc Default Template ##
## Application.cfc Default Template

Below you can find an Application.cfc template that may serve as a starting point for your own applications settings with Lucee CFML engine.

Expand Down
8 changes: 4 additions & 4 deletions docs/recipes/caches-in-application-cfc.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
]
}
-->
## Adding Caches via Application.cfc
# Adding Caches via Application.cfc

It is possible to add cache connections in Lucee 5.1+ on a per-application basis by adding configuration to your `Application.cfc`. You can also select the default object cache, query cache, function cache, etc. Note if these caches use an extension that provides the cache driver, the extension must be installed already.

Expand All @@ -44,7 +44,7 @@ this.cache.connections["myCache"] = {

Note, there is a shortcut for `this.cache.connections["myCache"] = {}` and that is `this.cache["myCache"] = {}`. We support both since the latter is closer to how datasources are defined.

### Generating Cache Connection code
## Generating Cache Connection code

The easiest way to generate the code block above is to follow these steps:

Expand All @@ -53,7 +53,7 @@ The easiest way to generate the code block above is to follow these steps:
3. Edit the cache and scroll to the bottom
4. Copy the code snippet that appears directly into your `Application.cfc`

### Cache metadata
## Cache metadata

Let's take a look at some of the keys used to define a cache connection.

Expand All @@ -64,7 +64,7 @@ Let's take a look at some of the keys used to define a cache connection.
* **custom** - A struct of key/value pairs for configuring the cache. This struct is entirely dependent on the cache driver in use, so refer to the docs for that cache driver to see the possible values. Note, some of these custom values might be required for some cache drivers to work.
* **default** - Optional. If you want this cache to be used as a default cache, then give this one of these values: `function`, `object`, `template`, `query`, `resource`, `include`, `http`, `file`, `webservice`.

### Default Caches
## Default Caches

When declaring a cache, you can make it the default cache for creation operations, but it is also possible to configure the default caches for each operation all at once in your `Application.cfc` like so:
```lucee
Expand Down
8 changes: 5 additions & 3 deletions docs/recipes/checksum.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
]
}
-->
# Checksum

This document explains how to use a checksum in Lucee.

Many servers provide a checksum for the files they provide for download. We use the checksum to validate a download file in order to avoid a corrupted file.

If you download a file in your application, you can automatically check if the download is valid or not if the necessary info was provided in the response header.

### Example 1 : ###
## Example 1

```luceescript
<cfscript>
Expand Down Expand Up @@ -80,7 +82,7 @@ dump("something went wrong! give it another try?");

If the checksum is provided, we can check it. However, the checksum may not always be provided. The following example shows how to provide a checksum for all downloads.

### Example 2 ###
## Example 2

//download.cfm

Expand Down Expand Up @@ -140,7 +142,7 @@ dump("something went wrong! give it another try?");

The above code checks and validates the downloaded file.

### Footnotes ###
## Footnotes

You can see the details in this video:
[Checksum](https://www.youtube.com/watch?v=Kb_zSsRDEOg)
6 changes: 3 additions & 3 deletions docs/recipes/configuration-administrator-cfc.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
]
}
-->
## Configure Lucee within your application
# Configure Lucee within your application

Lucee provides a web frontend to configure the server and each web context, but you can also do this configuration from within your application.
(For per request settings, please check out the "Application.cfc" section in the [Cookbook](/guides/cookbooks.html)).

### Administrator.cfc
## Administrator.cfc

Lucee provides the component "Administrator.cfc" in the package "org.lucee.cfml", a package auto imported in any template, so you can simply use that component as follows:

Expand All @@ -28,7 +28,7 @@ dump(admin); // show me the doc for the component
admin.updateCharset(resourceCharset: "UTF-8"); // set the resource charset
```

### cfadmin Tag
## cfadmin Tag

The component "Administrator" is far from being feature complete, so if you miss a functionality, best consult the unofficial tag "cfadmin" (undocumented) and check out how this tag is used inside the [Lucee Administrator](https://github.com/lucee/Lucee/blob/5.2/core/src/main/java/resource/component/org/lucee/cfml/Administrator.cfc).
Of course, it would be great if you could contribute your addition to the "Administrator" component.

0 comments on commit 4b1cbf4

Please sign in to comment.