You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/recipes/exception-cause.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ Lucee 6.1 improves its support for exception causes, providing better debugging
26
26
27
27
## Tag Attribute cause
28
28
29
-
The `<cfthrow>` tag now includes a new attribute, `cause`, which allows you to add a cause to a newly created exception.
29
+
The `<cfthrow>` tag now includes a `cause` attribute to chain exceptions:
30
30
31
31
```run
32
32
<cfscript>
@@ -45,11 +45,11 @@ catch(ex) {
45
45
</cfscript>
46
46
```
47
47
48
-
Thanks to this enhancement, you get not only the tag context and Java stack trace from the top-level exception, but also the same information for the "cause" exception.
48
+
This gives you the tag context and Java stack trace from both the top-level exception and its cause.
49
49
50
50
## Parent Thread Context
51
51
52
-
When you throw an exception from a child thread, for example, a `cfhttp` call executed in parallel or an exception inside the `cfthread` tag, you can now see the stack trace from where that thread was started. Previously, you only saw the stack trace within the child thread. With Lucee 6.1, you also get the information from the parent thread as the cause. Consider the following example:
52
+
Exceptions from child threads (parallel `cfhttp`, `cfthread`) now include the parent thread's stack trace as the cause - previously you only saw the child thread's stack trace:
The error not only includes the exception information from within the cfthread tag but also provides information from outside, making debugging much easier as you can see where the tag was called from.
65
+
The error includes both the exception from within `cfthread` and where it was called from, making debugging much easier.
If you encounter issues while installing extensions, you can check the log at `{lucee-installation}/lucee-server/context/logs/deploy.log` not only for any errors reported but also to see what actions were performed. This log is by default set to info level and should contain all details about the installation process.
191
-
192
-
## Conclusion
193
-
194
-
Lucee offers several methods to install extensions, each with its own advantages and disadvantages. Choose the method that best fits your deployment and management workflow:
195
-
196
-
-**Lucee Administrator**: Best for manual, ad-hoc installations.
197
-
-**`deploy` Directory**: Good for automated deployments with script support.
198
-
-**`.CFConfig.json` Configuration**: Ideal for managing configurations and extensions together.
199
-
-**Environment Variable / System Property**: Suitable for modern deployment environments like Docker and cloud services.
200
-
201
-
By understanding the pros and cons of each method, you can effectively manage Lucee extensions in your environment.
Copy file name to clipboardExpand all lines: docs/recipes/externalizing-strings.md
+10-20Lines changed: 10 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,15 +16,14 @@
16
16
}
17
17
-->
18
18
19
-
# Externalize strings
19
+
# Externalize Strings
20
20
21
-
Externalize strings from generated class files to separate files. This method is used to reduce the memory of the static contents for templates. We explain this method with a simple example below:
21
+
When Lucee compiles a `.cfm` file, all the static HTML and strings get embedded directly in the Java class file. For pages with lots of static content (like email templates or HTML-heavy pages), this bloats the class files and wastes memory - those strings stay loaded even when not needed.
22
22
23
-
**Example:**
24
-
25
-
//index.cfm
23
+
Externalizing strings moves this static content to separate text files. The class file shrinks, and strings only load on demand when the page actually runs.
26
24
27
25
```lucee
26
+
<!--- index.cfm - mostly static HTML with a bit of CFML --->
28
27
<cfset year = 1960>
29
28
<html>
30
29
<body>
@@ -38,21 +37,12 @@ Externalize strings from generated class files to separate files. This method is
38
37
</html>
39
38
```
40
39
41
-
1. Here the Index.cfm file contains a lot of strings (static contents), but there is no functionality. The file just gives a cfoutput with year. The variable string 'year' is already declared by using in top of the Index.cfm page.
42
-
43
-
2. Execute the CFM page in a browser. A class file is created in the `webapps/ROOT/WEB-INF/lucee/cfclasses/` directory while the CFM file is executed. The run time compiler compiles that file to load the Java bytecode and execute it.
44
-
45
-
3. Right click the class file. Then see `Get info`. For example, in my class file there is 8Kb size on the disk. In Lucee, the CFM file with its strings was also loaded. So a lot of memory could be occupied just by string loading the bytecode. To avoid this problem, the Lucee admin has the following solution:
- This `Externalize strings` setting has four options. Select any one option to test. We selected the fourth option (externalize strings larger than 10 characters).
49
-
- Again run the CFM page in a browser. The class file is created with lower memory size than the original 8Kb on disk.
50
-
- In addition, it created a text file too. The text file contains the strings from the CFM page. The cfoutput with year is simply not there. The byte code will crop the piece of cfoutput content from the CFM file.
51
-
52
-
So, the string 'year' is no longer in memory. When the bytecode is called, it loads the string into memory. The memory is not occupied forever and this reduces the footprint of our application.
40
+
Without externalization, all that HTML lives in the class file. With it enabled, only the CFML logic stays in the class.
53
41
54
-
## Footnotes
42
+
Configure via **Lucee Admin > Language/compiler > Externalize strings**:
55
43
56
-
Here you can see the above details in video
44
+
- Strings are moved to separate text files
45
+
- Class file size decreases
46
+
- Strings load on demand instead of staying in memory
Copy file name to clipboardExpand all lines: docs/recipes/file-extensions.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,11 +19,11 @@
19
19
20
20
# File Extensions
21
21
22
-
Lucee supports several file extensions for different types of templates and components. The most common extensions are `.cfm`, `.cfc`, `.cfml`, and `.cfs`. Each serves a specific purpose in CFML development.
22
+
Lucee processes several file types, each serving a different purpose in CFML development. Knowing when to use each helps keep your code organized.
23
23
24
24
## .cfm
25
25
26
-
The `.cfm` extension is used for CFML templates. These files contain CFML code that is processed by the server to generate dynamic web pages.
26
+
The standard CFML template extension. These files mix CFML tags and HTML to generate dynamic web pages - the workhorse of most CFML applications.
27
27
28
28
### Example
29
29
@@ -44,7 +44,7 @@ The `.cfm` extension is used for CFML templates. These files contain CFML code t
44
44
45
45
## .cfc
46
46
47
-
The `.cfc` extension is used for CFML Components (CFCs). These files define reusable components that encapsulate functionality in methods, similar to classes in object-oriented programming.
47
+
CFML Components define reusable objects that encapsulate data and behavior - similar to classes in other languages. Use these for your business logic, models, and services.
48
48
49
49
### Example
50
50
@@ -58,11 +58,11 @@ component {
58
58
59
59
## .cfml
60
60
61
-
The `.cfml`extension is an alternative to `.cfm` and can be used for CFML templates. It serves the same purpose as `.cfm`but is less commonly used.
61
+
Alternative extension for CFML templates - functionally identical to `.cfm`. Some developers prefer the explicit `.cfml` extension, but `.cfm` is far more common.
62
62
63
63
## .cfs
64
64
65
-
Since version 6.0, Lucee supports templates with the extension `.cfs`. These templates contain script code, similar to `.js` files in the JavaScript world. This allows you to write direct script code without the need for the `<cfscript>`tag.
65
+
Script-only templates introduced in Lucee 6.0. Like `.js` files in the JavaScript world, these contain pure script code without needing `<cfscript>`tags. Great for scripts, utilities, and developers who prefer script syntax over tags.
Copy file name to clipboardExpand all lines: docs/recipes/function-listeners.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@
23
23
24
24
# Function Listeners
25
25
26
-
Lucee 6.1 introduced a new feature called "Function Listeners". This allows you to execute a function (of any kind) in parallel, so you do not have to wait for the result of the execution, similar to using the `cfthread`tag. Function Listeners provide an easy syntax to not only execute a function in parallel but also include support to handle the result by simply adding a listener after the function call. This listener can handle the result or exception of a function.
26
+
Execute functions in parallel with a simple listener syntax. Like `cfthread` but cleaner - attach a listener after any function call to handle results or exceptions asynchronously.
Copy file name to clipboardExpand all lines: docs/recipes/hidden-gems.md
+22-48Lines changed: 22 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,29 +11,30 @@
11
11
"Bracket notation",
12
12
"URL form scopes",
13
13
"Array format"
14
+
],
15
+
"categories": [
16
+
"language"
14
17
]
15
18
}
16
19
-->
17
20
18
21
# Hidden Gems
19
22
20
-
This document explains how to declare variables, function calls with dot and bracket notation, and passing arguments via URL/form scopes as an array. These concepts are explained with simple examples below:
23
+
Lesser-known Lucee features that can make your code cleaner and more flexible. These aren't obscure - they're useful patterns that many developers overlook.
21
24
22
-
## Example 1: Declare Variables
23
-
24
-
// test.cfc
25
+
## Variable Declaration
25
26
26
27
```luceescript
28
+
// test.cfc
27
29
component {
28
30
function getName() {
29
31
return "Susi";
30
32
}
31
33
}
32
34
```
33
35
34
-
// example1.cfm
35
-
36
36
```luceescript
37
+
// example.cfm
37
38
function test() {
38
39
var qry;
39
40
dump(qry);
@@ -45,50 +46,42 @@ function test() {
45
46
test();
46
47
```
47
48
48
-
In the cfm page, we have a test() function with a local variable scope assigned as an empty string `var qry`. When executing this cfm, the qry returns "1". Dumping the `qry` below the var declaration returns an empty string.
49
-
50
-
## Example 2: Dot and Bracket Notation for Function Calls
49
+
Declaring `var qry` creates an empty local variable. The query then populates it.
51
50
52
-
Lucee allows you to use bracket notation to call a component function.
51
+
## Bracket Notation for Function Calls
53
52
54
-
// example2.cfm
53
+
You can call component methods using bracket notation instead of dot notation. This lets you call functions dynamically without the overhead and security concerns of `evaluate()`:
55
54
56
55
```luceescript
57
-
// UDF call via dot notation
56
+
// Standard dot notation
58
57
test = new Test();
59
58
dump( test.getName() );
60
-
// Dynamic function name
59
+
60
+
// Dynamic with evaluate (avoid this)
61
61
funcName = "getName";
62
-
dump(evaluate('test.#funcName#()'));
63
-
// UDF call via bracket notation
62
+
dump( evaluate('test.#funcName#()') );
63
+
64
+
// Dynamic with bracket notation (better!)
64
65
funcName = "getName";
65
66
dump( test[funcName]() );
66
67
```
67
68
68
-
These three different types of function calls are:
69
-
70
-
- Calling the user-defined function `getName()` from the component.
71
-
- Dynamic function name with evaluate function.
72
-
- User-defined function via bracket notation.
73
-
74
-
All three different function calls return the same content "Susi" as defined in the CFC page.
75
-
76
-
## Example 3: Passing Arguments via URL/Form Scopes as Array
69
+
All three return "Susi", but bracket notation is cleaner and safer than `evaluate()`.
77
70
78
-
Lucee allows passing URL and Form scope data as an array instead of a string list.
71
+
## URL/Form Arrays
79
72
80
-
// example3.cfm
73
+
When you have multiple form fields or URL parameters with the same name, Lucee normally merges them into a comma-separated string. Adding `[]` to the name tells Lucee to return an array instead - much easier to work with:
In this cfm page, URL and form scopes are available. The names are used twice.
112
-
113
-
- The query string on the URL scope has the same name `country` twice. Similarly, the form also has two fields with the same name `country`.
114
-
- Execute this cfm page in the browser & submit the form. It shows a single URL string list in merged format instead of two fields & Form fields also merged as a single `country` field.
115
-
- Adding square brackets behind the name `country[]` means it returns two separate strings in array format. You will see the difference in the browser while dumping that name with square brackets.
116
-
117
-
These simple methods are helpful for defining variables in different ways.
118
-
119
-
## Footnotes
120
-
121
-
Here you can see the above details in the video
95
+
With `country` you get `"USA,UAE"` (string). With `country[]` you get `["USA","UAE"]` (array).
Copy file name to clipboardExpand all lines: docs/recipes/hooks-and-monitors.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@
18
18
19
19
# Hooks and Monitors
20
20
21
-
Lucee provides two powerful extension mechanisms that allow you to inject custom functionality at different points in the application lifecycle: **Hooks**and **Monitors**. These systems enable you to extend Lucee's capabilities, implement custom initialization logic, collect runtime metrics, and integrate with external systems seamlessly.
21
+
Two extension mechanisms for custom functionality: **Hooks**run at lifecycle points (startup), **Monitors**collect runtime metrics (requests, actions, intervals).
Copy file name to clipboardExpand all lines: docs/recipes/http-logging.md
+4-23Lines changed: 4 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,35 +19,16 @@
19
19
20
20
# Logging CFHTTP Calls
21
21
22
-
As of Lucee 6.1.0.135, all `cfhttp` calls are logged by default to a dedicated `http` log file at the log level `info`. This logging behavior provides more visibility into HTTP requests made through Lucee applications, helping to track external requests easily.
23
-
24
-
## Default Logging Behavior
25
-
26
-
In the default setup, Lucee logs HTTP requests with the following settings:
27
-
28
-
-**Log File**: `http.log` (If the `http.log` log does not exist, entries are directed to `application.log`).
29
-
-**Log Level**: `info`.
22
+
All `cfhttp` calls are logged by default to a dedicated `http` log file at `info` level (falls back to `application.log` if `http.log` doesn't exist).
30
23
31
24
### Example Log Entry
32
25
33
-
An example entry for a `cfhttp` call might look like this:
34
-
35
26
```plaintext
36
27
"TRACE","pool-3-thread-2","10/29/2024","18:31:04","cftrace","httpRequest [GET] to [https://lucee.org], returned [200 OK] in 294ms, at /index.cfm:10; /index.cfm.callLucee():20"
0 commit comments