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/caches-defined-in-application-cfc.md
+14-29Lines changed: 14 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,15 +24,7 @@
24
24
25
25
# Caches defined in Application.cfc
26
26
27
-
It is possible to add cache connections in Lucee 5.1+ on a per-application basis by adding configuration to your `Application.cfc`.
28
-
29
-
You can also select the default object cache, query cache, function cache, etc.
30
-
31
-
Note if these caches use an extension that provides the cache driver, the extension must be installed already.
32
-
33
-
To declare cache connections, create a struct called `this.cache.connections` in the pseudo constructor of your `Application.cfc`.
34
-
35
-
Each key in the struct will be the name of the cache connection to create, and the value of the item will be another struct defining the properties of that cache connection.
27
+
Add per-application cache connections in `Application.cfc` (Lucee 5.1+). If using an extension-provided cache driver, the extension must be installed first.
The easiest way to generate the code block above is to follow these steps:
48
+
Generate the code via Lucee Admin:
59
49
60
-
1. Start up a Lucee server
61
-
2. Create the cache you want via the web admin
62
-
3. Edit the cache and scroll to the bottom
63
-
4. Copy the code snippet that appears directly into your `Application.cfc`
50
+
- Create the cache in Web Admin
51
+
- Edit the cache, scroll to bottom
52
+
- Copy the code snippet into `Application.cfc`
64
53
65
54
## Cache metadata
66
55
67
-
Let's take a look at some of the keys used to define a cache connection.
68
-
69
-
-**class** - This is the Java class of the driver for the cache engine.
70
-
-**bundleName** - Optional. The name of the OSGI bundle to load the `class` from.
71
-
-**bundleVersion** - Optional. The version of the OSGI bundle to load the `class` from.
72
-
-**storage** - A boolean that flags whether this cache can be used for client or session storage.
73
-
-**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.
74
-
-**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`.
56
+
-**class** - Java class of the cache driver
57
+
-**bundleName** - OSGi bundle name (optional)
58
+
-**bundleVersion** - OSGi bundle version (optional)
-**default** - Set as default for: `function`, `object`, `template`, `query`, `resource`, `include`, `http`, `file`, `webservice`
75
62
76
63
## Default Caches
77
64
78
-
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:
Copy file name to clipboardExpand all lines: docs/recipes/checksum.md
+7-46Lines changed: 7 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,13 +22,9 @@
22
22
23
23
# Checksum
24
24
25
-
This document explains how to use a checksum in Lucee.
25
+
Validate downloads using checksums provided in response headers.
26
26
27
-
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.
28
-
29
-
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.
30
-
31
-
## Example 1
27
+
## Download and Validate
32
28
33
29
```luceescript
34
30
<cfscript>
@@ -61,50 +57,20 @@ dump("something went wrong! give it another try?");
61
57
</cfscript>
62
58
```
63
59
64
-
- Download the jar file by using cfhttp.
65
-
- Dump the file response header. You can see the "X-Checksum-MD5" "X-Checksum-SHA1" keys from the file itself.
66
-
- Save the file, and dump(fileInfo(localFile.checksum)). Check to see if the dump matches the value of the downloaded file response["X-Checksum-MD5"] header.
67
-
68
-
Checksum values are hashed from the binaryfile itself.
dump("something went wrong! give it another try?");
87
-
}
88
-
}
89
-
```
90
-
91
-
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.
92
-
93
-
## Example 2
60
+
Check `X-Checksum-MD5` or `X-Checksum-SHA1` headers against `fileInfo().checksum` or `hash(fileReadBinary(file), "md5")`.
This code allows a downloading application to check if the download was successful or not. Adding the file with header content "Content-MD5" is not required.
106
-
107
-
Download the file using the below example code:
73
+
## Validate with Multiple Header Types
108
74
109
75
```luceescript
110
76
<cfscript>
@@ -148,9 +114,4 @@ dump("something went wrong! give it another try?");
148
114
</cfscript>
149
115
```
150
116
151
-
The above code checks and validates the downloaded file.
Copy file name to clipboardExpand all lines: docs/recipes/component-mappings.md
+3-9Lines changed: 3 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,17 +26,11 @@
26
26
27
27
# Component Mappings
28
28
29
-
Component mappings in Lucee define locations where the server will look for CFML components (CFC files) when using the `createObject()` function or the `new` operator.
29
+
A mapping in Lucee is an alias that points to a directory - instead of using full filesystem paths, you use a short name. Lucee has three types: regular mappings (for templates/includes), custom tag mappings (for custom tags), and component mappings (for CFCs).
30
30
31
-
They provide a way to organize and access your components without having to specify the full path each time.
31
+
Component mappings define where Lucee looks for CFCs when using `createObject()` or `new`. This lets you organize and access components without specifying full paths - useful in larger applications with multiple component packages.
32
32
33
-
## Understanding Component Mappings
34
-
35
-
Component mappings provide a way to organize and access your CFC files without having to specify the full path each time.
36
-
37
-
This is particularly useful in large applications with multiple component packages.
38
-
39
-
**Important**: Component mappings point to the root of package paths, not to individual components.
33
+
Mappings point to the root of package paths, not individual components.
Copy file name to clipboardExpand all lines: docs/recipes/configuration-administrator-cfc.md
+3-7Lines changed: 3 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,15 +17,12 @@
17
17
}
18
18
-->
19
19
20
-
# Configure Lucee within your application
20
+
# Configure Lucee Programmatically
21
21
22
-
Lucee provides a web frontend to configure the server and each web context, but you can also do this configuration from within your application.
23
-
(For per request settings, please check out the "Application.cfc" section in the [Cookbook](/guides/cookbooks.html)).
22
+
Configure Lucee from code using `Administrator.cfc` (for per-request settings, see [[tag-application]]).
24
23
25
24
## Administrator.cfc
26
25
27
-
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:
28
-
29
26
```cfs
30
27
admin = new Administrator("web", "myPassword"); // first argument is the admin type you want to load (web|server), second is the password for the Administrator
31
28
dump(admin); // show me the doc for the component
@@ -34,5 +31,4 @@ admin.updateCharset(resourceCharset: "UTF-8"); // set the resource charset
34
31
35
32
## cfadmin Tag
36
33
37
-
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).
38
-
Of course, it would be great if you could contribute your addition to the "Administrator" component.
34
+
For functionality not in `Administrator.cfc`, check the undocumented `cfadmin` tag usage in the [Lucee Administrator source](https://github.com/lucee/Lucee/blob/7.0/core/src/main/java/resource/component/org/lucee/cfml/Administrator.cfc). Contributions welcome!
Copy file name to clipboardExpand all lines: docs/recipes/console-logging.md
+7-19Lines changed: 7 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,29 +20,17 @@
20
20
}
21
21
-->
22
22
23
-
##Console Logging in Lucee
23
+
# Console Logging
24
24
25
-
Most CFML developers are familiar with using [[tag-dump]]when debugging.
25
+
Most CFML developers are familiar with [[tag-dump]]for debugging. [[function-systemoutput]] is similar but writes to the console - useful for CLI scripts, background tasks, and CI environments.
26
26
27
-
Lucee has a very useful function [[function-systemoutput]], which lets you write messages and dump objects to the console.
27
+
Like [[tag-dump]], it can output both text and complex objects. The second argument `addNewLine` controls whether a newline is added (default: `false`).
28
28
29
-
### What's the console?
29
+
##Access the Console
30
30
31
-
If you are using Tomcat, you can run it interactively using `catalina run` in the `tomcat\bin` directory.
32
-
33
-
With [[getting-started-commandbox]], you can do similar, via `box server start --console`.
34
-
35
-
Both then run the Server with the console logs being output.
36
-
37
-
### What can we log?
38
-
39
-
Similar to [[tag-dump]], [[function-systemoutput]] can output both text and complex objects.
40
-
41
-
By default, it doesn't output new lines, the second boolean argument, `addNewLine` does what it says.
42
-
43
-
### Use with CI like GitHub Actions
44
-
45
-
When you are running tests remotely, any output from [[function-systemoutput]] is then visible directly in the job log.
Copy file name to clipboardExpand all lines: docs/recipes/custom-tag-mappings.md
+1-7Lines changed: 1 addition & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,13 +28,7 @@
28
28
29
29
# Custom Tag Mappings
30
30
31
-
Custom tag mappings in Lucee define locations where the server will look for CFML custom tags when you use them in your code.
32
-
33
-
They provide a way to organize and access your custom tags without having to specify the full path each time or use [[tag-import]] repeatedly.
34
-
35
-
## Understanding Custom Tag Mappings
36
-
37
-
Custom tags are reusable CFML templates that you can call like built-in tags. Custom tag mappings tell Lucee where to find these custom tag files.
31
+
Custom tags are reusable CFML templates (`.cfm` files) that you can call like built-in tags. Custom tag mappings tell Lucee where to find these files, so you don't have to specify full paths or use [[tag-import]] repeatedly.
Copy file name to clipboardExpand all lines: docs/recipes/datasource-how-to-define-them.md
+49-15Lines changed: 49 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,32 +18,28 @@
18
18
}
19
19
-->
20
20
21
-
# Datasource - How to define them
21
+
# Datasources
22
22
23
-
To execute queries, you need a datasource definition, which points to a specific local or remote datasource. There are different ways to do so.
23
+
Define datasources to execute queries against local or remote databases.
24
24
25
-
## Create a Datasource in the Administrator
25
+
## Lucee Administrator
26
26
27
-
The most common way to define a datasource is in the Lucee Server or Web Administrator. The only difference between the Web and Server Administrator is that datasources defined in the Server Administrator are visible to all web contexts, while datasources defined in the Web Administrator are only visible to the current web context.
28
-
29
-
In your Administrator, go to the Page "Services/Datasource", in the section "create new Datasource" choose a name for your datasource and the type of your Datasource, for example "MySQL".
27
+
Go to Services > Datasource, create a new datasource by choosing a name and type (e.g. MySQL).
On the following page, you can define settings to connect to your datasource. The look and feel of this page depend on the datasource type used. After saving this page, you get back to the overview page and you will get feedback if Lucee was able to connect to your datasource or not.
31
+
Configure connection settings on the next page. Server Administrator datasources are visible to all web contexts; Web Administrator datasources only to the current context.
34
32
35
-
## Create a Datasource in the Application.cfc
33
+
## Application.cfc
36
34
37
-
You cannot only define a datasource in the Lucee Administrator, you can also do this in the [application-context-guide]. The easiest way to do so is to create a datasource in the Administrator (see above) and then go to the detail view of this datasource by clicking the "edit button".
35
+
Create a datasource in Administrator, then click "edit" to view its definition:
You can simply copy the code inside the box to your [application-context-guide] body, and Lucee will pick up this definition. After that, you can delete the datasource from the Administrator.
46
-
47
43
```cfs
48
44
this.datasources["myds"] = {
49
45
class: 'org.gjt.mm.mysql.Driver',
@@ -53,7 +49,7 @@ this.datasources["myds"] = {
53
49
};
54
50
```
55
51
56
-
Alternatively, you can also use this pattern:
52
+
Or use this pattern:
57
53
58
54
```cfs
59
55
this.datasources["myds"] = {
@@ -75,13 +71,13 @@ this.datasources["myds"] = {
75
71
76
72
### Default Datasource
77
73
78
-
With the [application-context-guide], you can also define a default datasource that is used if no "datasource" attribute is defined with the tag cfquery, cfstoredproc, cfinsert, cfupdate, etc. Simply do the following:
74
+
Define a default datasource used when no `datasource` attribute is specified in `cfquery`, `cfstoredproc`, etc.:
79
75
80
76
```cfs
81
77
this.defaultdatasource = "myds";
82
78
```
83
79
84
-
In that case, the datasource "myds" is used if there is no datasource defined. Instead of defining a datasource name, you can also define the datasource directly as follows:
Copy file name to clipboardExpand all lines: docs/recipes/directory-placeholders.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
@@ -17,7 +17,7 @@
17
17
18
18
## Directory Placeholders ##
19
19
20
-
In order to make configuring Lucee a little easier, there are several constants (we call them "directory placeholders") that contain a certain value which might change depending on the system, the environment or the context.
20
+
Directory placeholders are constants you can use in Lucee configuration instead of hardcoding paths. They resolve to actual paths at runtime, making your config portable across different systems and environments.
0 commit comments