Skip to content

Commit a3f6399

Browse files
committed
improve recipes
1 parent c394b37 commit a3f6399

30 files changed

+129
-206
lines changed

docs/recipes/ai.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ This feature is still a work in progress, and we are working to improve the qual
161161
### Monitor Documentation Tab
162162

163163
In the Monitor's Documentation tab, AI can answer questions about Lucee based on retrieval-augmented generation (RAG) with available documentation and links to related documents.
164-
This feature is also in development for enhanced input quality (read more about [https://github.com/lucee/lucee-docs/blob/master/docs/recipes/monitoring-debugging.md](Monitor Documentation) ).
164+
This feature is also in development for enhanced input quality (read more about [Monitor Documentation](monitoring-debugging.md)).
165165

166166
## Future Development
167167

docs/recipes/archives-creating-and-deploy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
# Archives - Creating and deploying Lucee Archives (.lar files)
1212

13-
This document explains how to deploy an Application on a live server without using a single CFML file.
13+
Deploy applications using compiled Lucee Archives (.lar files) without exposing CFML source.
1414

1515
## Using CFC file
1616

docs/recipes/basic-date.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
# Basic Date - Output the current date
2222

23-
The following examples show you how to output the current date.
24-
2523
```run
2624
<cfoutput>
2725
<p>The time is #lsdateTimeFormat(now())#</p>

docs/recipes/cached-within-request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
# Cache a Query for the current request
2424

25-
Perhaps you're familiar with the "cachedwithin" attribute of the tag [tag-query], which is normally used as follows:
25+
The `cachedWithin` attribute of [tag-query] is normally used like this:
2626

2727
```coldfusion
2828
<cfquery cachedWithin="#createTimeSpan(0,0,0,1)#">

docs/recipes/check-for-changes.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
## Check for changes in your configuration file automatically
2121

22-
Lucee can automatically check for changes in your configuration files from the complete server or a single web context.
23-
24-
This is useful if you are doing scripted deploys and/or synchronization from, for example, a master instance to many slave instances of Lucee.
22+
Lucee can automatically check for changes in configuration files - useful for scripted deploys and syncing from a primary instance to many replica instances.
2523

2624
### Check for Changes - CFconfig.json (6+)
2725

docs/recipes/dynamic-proxy-enhancements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
# Dynamic Proxy Enhancements in Lucee 7
2828

29-
Lucee 7 introduces significant improvements to dynamic proxy creation, making Java interoperability more seamless and predictable when components implement Java interfaces.
29+
All component functions and properties are now always included in dynamic proxies, making Java interoperability more predictable.
3030

3131
## What Changed in Lucee 7
3232

docs/recipes/event-gateway-create.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919

2020
# Custom Event Gateways
2121

22-
Here you will find a short introduction into writing your own Event Gateway type.
23-
24-
Since you can write these in pure CFML (and Java when you want it), it is really simple to do.
25-
26-
There are 2 to 3 files you need to create:
22+
Write custom Event Gateways in pure CFML (or Java). You need 2-3 files:
2723

2824
- the Gateway CFC
2925
- the Gateway Driver CFC
@@ -37,18 +33,18 @@ Also, it is the file which is instantiated by Lucee when the gateway starts.
3733

3834
You can take the following files as an example:
3935

40-
- {Lucee-install}/lib/lucee-server/context/gateway/lucee/extension/gateway/DirectoryWatcher.cfc
41-
- {Lucee-install}/lib/lucee-server/context/gateway/lucee/extension/gateway/MailWatcher.cfc
36+
- `{lucee-server}/context/gateway/DirectoryWatcher.cfc` ([source](https://github.com/lucee/Lucee/blob/7.0/core/src/main/cfml/context/gateway/DirectoryWatcher.cfc))
37+
- `{lucee-server}/context/gateway/MailWatcher.cfc` ([source](https://github.com/lucee/Lucee/blob/7.0/core/src/main/cfml/context/gateway/MailWatcher.cfc))
4238

43-
The example code shown underneath is a modified version of the DirectoryWatcher.cfc, which, at time of writing, is in line for reviewing at the Lucee team.
39+
The example code shown underneath is based on `DirectoryWatcher.cfc`.
4440

4541
By default, you need to have the following functions:
4642

47-
- An init function, which receives the necessary config data.
48-
- A start function, which continues to run while variables.state="running".
49-
- A stop and restart function.
50-
- A getState function, which returns the current state of the gateway instance (running, stopping, stopped).
51-
- A sendMessage function, which will be called when the CFML sendGatewayMessage function is used.
43+
- An `init` function, which receives the necessary config data.
44+
- A `start` function, which continues to run while `variables.state="running"`.
45+
- A `stop` and `restart` function.
46+
- A `getState` function, which returns the current state of the gateway instance (`running`, `stopping`, `stopped`).
47+
- A `sendMessage` function, which will be called when the CFML `sendGatewayMessage` function is used.
5248

5349
The following is all the code you need:
5450

@@ -98,8 +94,8 @@ The following is all the code you need:
9894
<cfquery name="qFile" datasource="#variables.config.datasource#">
9995
SELECT *
10096
FROM FILE
101-
WHERE directory = "#getDirectoryFromPath(variables.config.filepath)#"
102-
AND name = "#getFileFromPath(variables.config.filepath)#"
97+
WHERE directory = <cfqueryparam value="#getDirectoryFromPath(variables.config.filepath)#" cfsqltype="cf_sql_varchar">
98+
AND name = <cfqueryparam value="#getFileFromPath(variables.config.filepath)#" cfsqltype="cf_sql_varchar">
10399
</cfquery>
104100
105101
<!--- call the listener CFC if the file size meets the minimum requirement --->
@@ -110,11 +106,11 @@ The following is all the code you need:
110106
</cfcomponent>
111107
```
112108

113-
We will save the file as {Lucee-install}/lib/lucee-server/context/gateway/filesizechecker/FileSizeWatcher.cfc.
109+
We will save the file as `{lucee-server}/context/gateway/filesizechecker/FileSizeWatcher.cfc`.
114110

115-
The variables.listener and variables.config variables did not just come falling from the sky; instead, it was saved to the variables scope in the init() function.
111+
The `variables.listener` and `variables.config` variables did not just come falling from the sky; instead, they were saved to the variables scope in the `init()` function.
116112

117-
Lastly, we need to create the Gateway driver. We can use the Gateway driver code shown before, and then save it as {Lucee-install}/lib/lucee-server/context/admin/gdriver/FileSizeWatcher.cfc.
113+
Lastly, we need to create the Gateway driver. We can use the Gateway driver code shown before, and then save it as `{lucee-server}/context/admin/gdriver/FileSizeWatcher.cfc`.
118114

119115
Now we are almost good to go! We do need to restart Lucee to have it pick up the new Gateway driver. So just go to the server admin, click on the menu-item "Restart", and then hit the "Restart Lucee" button.
120116

docs/recipes/event-gateways-how-they-work.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This looping and sleeping does not count for all types of event gateways. For ex
2727

2828
This "doing what it is designed for" will be explained in more detail underneath.
2929

30-
# Which gateways are available?
30+
## Which gateways are available?
3131

3232
Lucee comes with 2 gateways: a Directory watcher and a Mail watcher.
3333

docs/recipes/exception-output.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
}
2424
-->
2525

26-
# Exceptions Output
26+
# Exception Output
2727

2828
How to catch and display exceptions
2929

30-
## Example
30+
## Using dump() for Full Exception Details
3131

3232
```run
3333
<cfscript>
@@ -41,9 +41,9 @@ catch ( any e ){
4141
Go on with your code
4242
```
4343

44-
[tag-Dump] shows the full exception structure without blocking your code. Dump includes all stack trace with it.
44+
[[tag-dump]] shows the full exception structure without blocking your code. Dump includes the full stack trace.
4545

46-
## Example 2
46+
## Using echo() for Simple Output
4747

4848
```lucee
4949
<cfscript>

docs/recipes/function-systemoutput.md

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,70 +22,47 @@
2222

2323
# Function SystemOutput
2424

25-
This document explains the systemOutput function with some simple examples.
25+
[[function-systemOutput]] is like [[tag-dump]] for your console - supports complex types. Visible in Docker logs.
2626

27-
It's like dump() for your console, including support for complex types.
28-
29-
For example, if you are using Docker, you can see this output in the console logs.
30-
31-
## Example 1:
27+
## Browser vs Console
3228

3329
```luceescript
34-
<cfscript>
35-
directory action="list" directory=getDirectoryFromPath(getCurrentTemplatePath()) filter="example*.cfm" name="dir";
36-
loop query=dir {
37-
echo('<a href="#dir.name#">#dir.name#</a><br>');
38-
}
39-
</cfscript>
40-
```
41-
42-
```lucee
43-
<cfscript>
44-
dump(cgi); // or writedump if you love to write more
45-
echo(now()); // or writeoutput if you love to write more
46-
</cfscript>
30+
dump(cgi); // browser output (or writeDump if you love to write more)
31+
echo(now()); // browser output (or writeOutput if you love to write more)
32+
systemOutput(cgi, true); // console output
33+
systemOutput(now(), true); // console output
4734
```
4835

49-
This example has a simple dump with CGI. It displays normally in the browser while we are running example1.cfm.
50-
51-
## Example 2:
36+
## New Line
5237

5338
```luceescript
54-
// example2.cfm
55-
systemOutput(now(),true); // with new line
39+
systemOutput(now(), true); // with new line
5640
```
5741

58-
systemOutput() creates output content in the web browser (console). Here the systemoutput has two arguments: first argument _now()_ for current date and time, and second argument _true_ for a new line. Run this in the browser and see the content in the console.
42+
Second argument `true` adds a newline.
5943

60-
## Example 3:
44+
## Error Stream
6145

6246
```luceescript
63-
// example3.cfm
64-
systemOutput(now(),true,true); // send to error stream
47+
systemOutput(now(), true, true); // send to error stream
6548
```
6649

67-
This example uses three arguments: first argument `now()` for current date and time, second argument `true` for a new line, and third argument for the stream. The stream argument indicates which stream the output should go. There are two streams to choose from: "Output stream" and "Error stream". A value of true in the third argument indicates the output should go to the error stream. Run this in the browser and see the contents with the output stream in the console.
50+
Third argument `true` writes to stderr instead of stdout.
6851

69-
## Example 4:
52+
## Complex Objects
7053

7154
```luceescript
72-
// example4.cfm
73-
systemOutput(cgi,true); // complex object
55+
systemOutput(cgi, true); // complex object
7456
```
7557

76-
In addition to simple strings or simple values, you can also pass complex objects to the SystemOutput() function. In this example we pass CGI as the argument. When you run this in the browser, you get a serialized output in the console.
58+
Outputs serialized representation of structs, queries, etc.
7759

78-
## Example 5:
60+
## Stack Trace
7961

8062
```luceescript
81-
// example5.cfm
82-
systemOutput("Here we are:<print-stack-trace>",true); // complex object
63+
systemOutput("Here we are:<print-stack-trace>", true);
8364
```
8465

85-
SystemOutput() has another good feature too. There is `<print-stack-trace>` used to show helpful information (where it is, which template, on which line number) while we mouse over the dump content. Lucee will detect and show the stack-trace if we add `<print-stack-trace>` to the SystemOutput() function in our code. When we run this in the browser, we see the stack-trace in the console.
86-
87-
## Footnotes
88-
89-
Here you can see these details on video also:
66+
The `<print-stack-trace>` placeholder outputs the current stack trace.
9067

91-
[Function SystemOutput](https://www.youtube.com/watch?v=X_BQPFPD320)
68+
Video: [Function SystemOutput](https://www.youtube.com/watch?v=X_BQPFPD320)

0 commit comments

Comments
 (0)