### English Installer Message Example Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/10.get-involved/03.installer-Translation/page.md This is an example of an English installer message. Variable names must remain consistent across all translations. Installer variables like %1$s will be replaced with dynamic content. ```text Installer.Welcome.Text=Welcome to the %1$s Setup Wizard. ``` -------------------------------- ### German Installer Message Example Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/10.get-involved/03.installer-Translation/page.md This is an example of a translated installer message in German. The variable name 'Installer.Welcome.Text' remains the same as the English version. ```text Installer.Welcome.Text=Wilkommen beim Setup Assistenten für %1$s . ``` -------------------------------- ### Installer Message with Line Break Example Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/10.get-involved/03.installer-Translation/page.md This example demonstrates how to include a line break in an installer message using '\n'. The translated text will appear on two separate lines in the installer. ```text postInstall.installingBonCodeConnector=Installing IIS Connector\n (this can take some time...) ``` -------------------------------- ### Start MongoDB Server Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/06.extensions/11.extension-mongoDB/page.md Starts the MongoDB server instance from the terminal. Ensure you are in the MongoDB installation directory. ```bash sudo /Applications/mongodb/bin/mongod ``` -------------------------------- ### Cloning and Running the Lucee AST Docker Demo Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/ast.md Provides the bash commands to clone the Lucee documentation repository, navigate to the AST Docker example directory, and start the Docker containers. This setup allows for testing AST functionality in a pre-configured environment. ```bash # Clone and run the demo git clone https://github.com/lucee/lucee-docs.git cd lucee-docs/examples/docker/ast docker-compose up -d # Open http://localhost:8888 ``` -------------------------------- ### Remote Server Setup Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/11.deploy-with-capistrano/page.md Prepare the remote server by creating the deployment directory, a 'deploy' user, and ensuring the user has write permissions. Git must also be installed on the server. ```bash mkdir -p /var/www/myproject/production useradd deploy chown -R deploy /var/www/myproject/ ``` -------------------------------- ### Start Tomcat Service on Windows Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/02.windows/11.starting-tomcat-and-verifying-the-installation-on-windows/page.md Use this command to start the Tomcat service. The service name can be configured during installation. ```bash net start lucee ``` -------------------------------- ### Build and Start Docker Services Source: https://github.com/lucee/lucee-docs/blob/master/examples/docker/s3-ministack/readme.md Build the Docker image for the Lucee S3 MiniStack example and then start all the necessary services using Docker Compose. ```bash # Build the image first docker build -t lucee-s3-ministack . # Then start all services docker compose up -d ``` -------------------------------- ### Install Authbind Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/11.lucee-server-adminstration-linux/02.configure-Tomcat-listen-to-port/page.md Install the authbind utility using apt-get. ```bash sudo apt-get install authbind ``` -------------------------------- ### Simple CFML Hello World Example Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/26.server2008-IIS7.5/page.md A basic CFML file to test Lucee installation. It outputs a 'Hello World!' message and the current server time. ```cfml

Hello World!


The time is #now()#
``` -------------------------------- ### Install Method for Extension Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/32.tutorial-lucee/01.tutorial-extension-provider/04.tutorial-part-4/page.md This method is invoked by Lucee to install the extension. It calls a super method for initial setup and then proceeds to create database tables and provides user feedback. ```lucee

Done!

You can now start posting from your administration at: #contractPath(config.mixed.destination_path)#/admin/

Then you can view your blog at: #contractPath(config.mixed.destination_path)#

``` -------------------------------- ### Dockerfile Setup for onBuild Execution Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/docker-onbuild.md This Dockerfile example demonstrates how to copy a custom Server.cfc, set the LUCEE_BUILD environment variable to true to trigger the onBuild function, and expose the necessary port. ```dockerfile FROM lucee/lucee:latest # Copy your Server.cfc into the appropriate directory COPY Server.cfc /opt/lucee-server/context/context/Server.cfc # Set the environment variable to trigger onBuild ENV LUCEE_BUILD true # Expose necessary ports EXPOSE 8888 # Start Lucee server COPY supporting/prewarm.sh /usr/local/tomcat/bin/ RUN chmod +x /usr/local/tomcat/bin/prewarm.sh RUN /usr/local/tomcat/bin/prewarm.sh 6.1 ``` -------------------------------- ### Start Lucee/Tomcat Server Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/05.installation-linux/04.upgrade-JRE/page.md After replacing the JRE, start the Lucee/Tomcat server to apply the changes. This command assumes a default Lucee installation path. ```bash $ sudo /opt/lucee/lucee_ctl start ``` -------------------------------- ### Example Extension File Structure Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/custom-tags-via-extensions.md Files placed in the `context/` folder of a .lex archive are copied to `/lucee-server/context/` upon installation. This example shows how to structure an extension to provide custom tags. ```text context/ whatever/ MyTag.cfm AnotherTag.cfc ``` -------------------------------- ### Start Lucee HTTPD with custom arguments Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/25.server2003-IIS6/page.md Execute this command in the Lucee installation directory if Lucee fails to start. It allows you to see the reason for the failure. Adjust Java heap size and configuration paths as needed. ```bash C:\Lucee>httpd.exe -Xms512M -Xmx512M -conf conf/resin.conf -java_home jre -java_exe jre\bin\java ``` -------------------------------- ### Link to Trycf.com Examples Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/32.tutorial-lucee/04.tutorial-reporting-bugs/page.md Create reduced examples on Trycf.com to demonstrate reproducible bugs. ```html Reduced [Trycf.com examples](https://trycf.com) ``` -------------------------------- ### Display Installer Help Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/05.installation-linux/05.installing-in-unattended-mode/page.md View all available command-line options for the Lucee installer by passing the `--help` flag. ```bash # lucee-[version]-installer.run --help ``` -------------------------------- ### Make Script Executable and Start Tomcat Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/03.osx/01.installing-tomcat-and-lucee-on-os-x-using-the-lucee-war-file/page.md Grant execute permissions to the startup script and then run it to start Tomcat. ```bash chmod +x startup.sh ./startup.sh ``` -------------------------------- ### Build and Run Lucee MCP Server with Docker Compose Source: https://github.com/lucee/lucee-docs/blob/master/examples/docker/mcp/readme.md Navigate to the example directory and start the Lucee MCP server using Docker Compose. This command builds the Docker image and starts the services in detached mode. ```bash cd examples/docker/mcp docker compose up -d --build ``` -------------------------------- ### Example: Using ArrayLen BIF with ClassUtil Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/extension-utilities.md Demonstrates creating an array, loading the ArrayLen BIF using ClassUtil, and invoking it to get the array's length. Ensure connections are released in a finally block. ```java Creation creator = engine.getCreationUtil(); ClassUtil classing = engine.getClassUtil(); // Create an array Array arr = creator.createArray(); arr.append("item1"); arr.append("item2"); // Load and invoke ArrayLen function BIF arrayLen = classing.loadBIF(pc, "lucee.runtime.functions.array.ArrayLen"); Object length = arrayLen.invoke(pc, new Object[] { arr }); System.out.println("Array length: " + length); // Output: 2 ``` -------------------------------- ### Start and Enable Tomcat Instances Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/33.ubuntu-lucee-with-Tomcat7-multi-instance/page.md Start each Tomcat instance using its custom init script and configure them to start automatically on system boot. Disable the original generic Tomcat service. ```bash service tomcat7-instance1 start service tomcat7-instance2 start service tomcat7-instance3 start ``` ```bash update-rc.d tomcat7-instance1 defaults update-rc.d tomcat7-instance2 defaults update-rc.d tomcat7-instance3 defaults ``` ```bash update-rc.d tomcat7 disable ``` -------------------------------- ### Run Lucee Installer from Command-Line Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/05.installation-linux/02.launching-the-installer/page.md Navigate to the download location, grant execute permissions, and run the installer. The installer will auto-detect the environment and launch in graphical or text mode. ```bash $ cd [download location] $ chmod 744 lucee-[version]-linux-installer.bin $ sudo ./lucee-[version]-linux-installer.bin ``` -------------------------------- ### Install CommandBox Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/05.installation-linux/08.linux-install-ubuntu-commandbox/page.md Install CommandBox by adding its repository and then installing the package. Ensure apt-transport-https is installed. ```bash $ sudo apt install libappindicator-dev $ curl -fsSl https://downloads.ortussolutions.com/debs/gpg | sudo apt-key add - $ echo "deb https://downloads.ortussolutions.com/debs/noarch /" | sudo tee -a /etc/apt/sources.list.d/commandbox.list $ sudo apt update && sudo apt install apt-transport-https commandbox ``` -------------------------------- ### Start Lucee Service (Ubuntu) Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/08.lucee-5/15.upgrading-lucee-45/page.md Use this command to start the Lucee service on Ubuntu systems after upgrading. ```bash sudo service lucee_ctl start ``` -------------------------------- ### Full Quartz Scheduler Configuration Example Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/scheduler-quartz.md A comprehensive example demonstrating clustered configuration with a datasource store, including job definitions (URL, interval, cron-based), and listener configuration. ```json { "primary": "store", "jobs": [ { "label": "External API Call", "url": "https://api.example.com/daily-report", "cron": "0 0 8 * * ?", "pause": false }, { "label": "Local Data Processing", "url": "/tasks/process-data.cfm", "interval": "3600", "endAt": "December 31, 2025 23:59:59" }, { "label": "Database Maintenance", "component": "com.example.tasks.DatabaseMaintenance", "cron": "0 0 3 ? * SUN", "mode": "singleton", "customParam1": "value1", "customParam2": 123 } ], "listeners": [ { "component": "com.example.scheduler.ExecutionListener", "stream": "err" } ], "store": { "type": "datasource", "datasource": "quartz", "tablePrefix": "QRTZ_", "cluster": true } } ``` -------------------------------- ### Basic Startup Analysis Configuration Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/thread-dump-startup.md Configure thread dumps to capture for the first 5 seconds of startup with 50ms intervals. This is useful for a general overview of the startup process. ```bash export LUCEE_DUMP_THREADS=/var/log/lucee/startup-analysis.jsonl export LUCEE_DUMP_THREADS_MAX=5000 export LUCEE_DUMP_THREADS_INTERVAL=50 ``` -------------------------------- ### Start CommandBox Service Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/05.installation-linux/08.linux-install-ubuntu-commandbox/page.md Starts the CommandBox service immediately. ```bash $ sudo systemctl start commandbox-myapp.service ``` -------------------------------- ### DirectoryWatcher CFC Example for Lucee Gateway Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/event-gateway-create.md This CFML component serves as a template for a Lucee event gateway. It includes essential functions for initialization, starting, stopping, restarting, getting the state, and handling messages. The `init` function sets up initial variables, `start` runs a loop to check conditions, and `checkFileSize` demonstrates querying file information and interacting with a listener component. ```cfml SELECT * FROM FILE WHERE directory = AND name = ``` -------------------------------- ### Hello World CFML Example Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/01.getting-started/06.commandbox/chapter.md Create an index.cfm file to display 'Hello World' using CFML. This demonstrates setting a variable and outputting it. ```lucee

#testVar#

``` -------------------------------- ### Install OpenJDK Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/05.installation-linux/08.linux-install-ubuntu-commandbox/page.md Update package lists and install the default Java Development Kit (OpenJDK) required by CommandBox. ```bash $ sudo apt update $ sudo apt install default-jdk ``` -------------------------------- ### Create Web Root and Test File Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/05.installation-linux/08.linux-install-ubuntu-commandbox/page.md Create a 'wwwroot' directory in /var/www/ and add an index.cfm file for testing CommandBox functionality. ```bash $ sudo thunar ``` ```cfm ``` -------------------------------- ### Install Tomcat Service Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/02.windows/12.configuring-tomcat-as-a-windows-service/page.md Use this command to install the Tomcat service without starting it. Further configuration is required. ```bash "C:\Program Files\Tomcat\bin\tomcat8.exe" //IS//Tomcat8 --DisplayName="Apache Tomcat Application Server" ``` -------------------------------- ### Install Tomcat Service with Basic Configuration Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/02.windows/12.configuring-tomcat-as-a-windows-service/page.md This command installs the Tomcat service and sets its display name, description, and startup type to 'auto'. ```bash "C:\Program Files\Tomcat\bin\tomcat8.exe" //IS//Tomcat8 --DisplayName="Apache Tomcat Application Server" --Description="Apache Tomcat Application Server" --Startup="auto" ``` -------------------------------- ### Launch Lucee Installer in Unattended Mode Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/05.installation-linux/05.installing-in-unattended-mode/page.md Use this command to start the Lucee installer silently. Default values will be used for most options. ```bash # lucee-[version]-installer.run --mode unattended ``` -------------------------------- ### ResourceUtil: Download and Process Example Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/extension-utilities.md Demonstrates downloading a file from an HTTP URL, saving it locally, and then reading its content using ResourceUtil. ```java ResourceUtil resUtil = engine.getResourceUtil(); // Download from HTTP and save locally Resource remoteFile = pc.getConfig().getResource("https://example.com/data.csv"); Resource localFile = resUtil.getTempDirectory().getRealResource("downloaded.csv"); resUtil.copy(remoteFile, localFile); // Process the file String csvData = resUtil.toString(localFile, "UTF-8"); ``` -------------------------------- ### Example Host and Context Configuration in server.xml Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/10.lucee-server-adminstration-windows/05.utilizing-Tomcat-server-xml-file/page.md This is an example of how to configure a Host and its associated Context within Tomcat's server.xml file. Replace bracketed placeholders with your specific domain name and system path. Ensure comments are removed before saving. ```xml < !-- Add additional VIRTUALHOSTS by copying the following example config: REPLACE: [ENTER DOMAIN NAME] with a domain, IE: mysite.com [ENTER SYSTEM PATH] with your web site's base directory. IE: /home/user/mysite.com/ or C:\\websites\\mysite.com\\ etc... [ENTER ALIAS DOMAIN] with a domain alias, like www.mysite.com (This is an optional parameter) Don't forget to remove comments! ;) --> < !-- [ENTER ALIAS DOMAIN] --> ``` -------------------------------- ### YAML Front Matter Example Source: https://github.com/lucee/lucee-docs/blob/master/docs/06.docs/02.markdown/page.md Example of YAML front matter used for guides, reference pages, and categories. It is delimited by triple dashes. ```yaml --- id: function-abs title: Abs() description: Returns the absolute value of a number. categories: - number - math related: - function-sgn - function-ceiling --- ``` -------------------------------- ### Build Static Documentation Source: https://github.com/lucee/lucee-docs/blob/master/README.md Execute build scripts to generate static HTML documentation and Dash docsets. Ensure CommandBox is installed and in your PATH. ```bash documentation>./build.sh|bat ``` -------------------------------- ### Create Directory and Copy Java Files Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/02.windows/06.installing-the-server-jre-on-windows/page.md Use this command to create the installation directory and copy the Java Server JRE files from a temporary location. Ensure the source path reflects the correct update version. ```bash md "C:\Program Files\Oracle Java Server" xcopy D:\Temp\jdk1.8.0_31\*.* "C:\Program Files\Oracle Java Server" /s ``` -------------------------------- ### Lucee Admin API - Get Extensions Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/39.cfadmin/page.md Retrieves the list of installed extensions. ```APIDOC ## GET /lucee/admin/api/extensions ### Description Retrieves the list of installed extensions. ### Method GET ### Endpoint /lucee/admin/api/extensions ### Parameters #### Query Parameters - **password** (string) - Required - The administrator password. - **returnVariable** (string) - Optional - The variable name to return the results in. ### Response #### Success Response (200) - **extensions** (array) - A list of installed extensions. ``` -------------------------------- ### Get Array Section with arrayMid - LuceeScript Source: https://github.com/lucee/lucee-docs/blob/master/docs/03.reference/01.functions/arraymid/_examples.md Use arrayMid to extract a portion of an array starting from a specified index. The member function aNames.mid(start, count) provides similar functionality. ```luceescript aNames = array(10412,42,33,2,999,12769,888); dump(arrayMid(aNames,2)); //member function dump(aNames.mid(2,4)); ``` -------------------------------- ### Execute Lucee Command-Line Installer Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/05.installation-linux/02.launching-the-installer/page.md Navigate to the download directory, make the installer executable, and run it with sudo privileges. You will be prompted for your user password to grant root permissions. ```bash cd [download location] chmod 744 lucee-[version]-linux-installer.bin sudo ./lucee-[version]-linux-installer.bin ``` -------------------------------- ### Get Entity Names with Default Delimiter Source: https://github.com/lucee/lucee-docs/blob/master/docs/03.reference/01.functions/entitynamelist/_examples.md Retrieves a comma-separated list of entity names. No setup is required. ```luceescript // Default comma delimiter names = entityNameList(); // "User,Product,Order" ``` -------------------------------- ### Run Local Documentation Server Source: https://github.com/lucee/lucee-docs/blob/master/docs/06.docs/02.build/chapter.md Start a local development server for the documentation using CommandBox. This server runs on port 4040 and automatically reloads documentation changes. ```bash ./serve.sh or serve.bat ``` -------------------------------- ### Lucee reFind Basic and Advanced Usage Source: https://github.com/lucee/lucee-docs/blob/master/docs/03.reference/05.objects/string/refind/_examples.md Demonstrates basic and advanced usage of the reFind function. The first example performs a simple search for digits. The second example specifies a start position and case sensitivity. ```luceescript writeDump("test 123!".reFind("[0-9]+")); ``` ```luceescript writeDump("test 123".reFind("[0-9]+",7,true)); ``` -------------------------------- ### Get Extensions using CFAdmin Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/39.cfadmin/page.md Use this action to retrieve a list of installed extensions. Specify the type and password. ```cfml ``` -------------------------------- ### Create User and Group for New Site Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/11.lucee-server-adminstration-linux/03.adding-new-site/page.md Creates a new user and group, and their home directory, for a new website. This is the first step in manually setting up a new site. ```bash $ sudo useradd -k utdream ``` -------------------------------- ### Run Local Development Server Source: https://github.com/lucee/lucee-docs/blob/master/README.md Start a local development server using CommandBox on port 4040 for real-time documentation development. Changes to source docs trigger internal rebuilds. ```bash documentation>./serve.sh|bat ``` -------------------------------- ### Install Lucee 5 WAR and Configure Tomcat Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/33.ubuntu-lucee-with-Tomcat7-multi-instance/page.md Installs Lucee 5.2.9.31 WAR, deploys it to Tomcat, moves Lucee libraries, and configures Tomcat to use the new library path. This is a setup step for Lucee integration. ```bash wget https://cdn.lucee.org/lucee-5.2.9.31.war -O lucee-5.2.9.31.war cp lucee-5.2.9.31.war /var/lib/tomcat7/webapps/lucee.war service tomcat7 start mkdir /usr/share/tomcat7/lucee cp -R /var/lib/tomcat7/webapps/lucee/WEB-INF/lib/* /usr/share/tomcat7/lucee chown -R tomcat7.tomcat7 /usr/share/tomcat7/lucee service tomcat7 stop rm -rf /var/lib/tomcat7/webapps/lucee/ /var/lib/tomcat7/webapps/lucee.war ``` -------------------------------- ### Lucee getDownloadDetails Method Example Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/32.tutorial-lucee/01.tutorial-extension-provider/01.tutorial-part-1/page.md This function is called by the Lucee administrator during application installation. It checks for user credentials and installation credits before returning a download URL. Ensure your database queries and user credential handling are implemented correctly. ```lucee ``` -------------------------------- ### Using listRest() as a standalone function Source: https://github.com/lucee/lucee-docs/blob/master/docs/03.reference/01.functions/listrest/_examples.md Demonstrates using listRest() as a standalone function to get elements from a comma-delimited string starting from the second element. ```luceescript writeOutput(listRest("string,Lucee,susi,LAS")&"

"); ``` -------------------------------- ### S3 File System Example Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/16.file-system/page.md Provides an example of connecting to S3, including authentication credentials and a path to a file or directory. ```lucee s3://ddsfdsfer34ewe:ewdkwhekwrh3432@amazonaws.com/somedir/somefile.txt ``` -------------------------------- ### Get Array Sub-section with arraySlice Source: https://github.com/lucee/lucee-docs/blob/master/docs/03.reference/01.functions/arrayslice/_examples.md Use the arraySlice function to extract a portion of an array. Specify the starting index and the number of elements to include. ```luceescript newArray = ['a','b','c','b','d','b','e','f']; dump(newArray); hasSome1 = arraySlice(newArray,1,4); dump(hasSome1); ``` -------------------------------- ### Enable Apache Site and Reload Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/33.ubuntu-lucee-with-Tomcat7-multi-instance/page.md Enable the newly created virtual host configuration and reload the Apache service to apply the changes. ```bash a2ensite mysite.com service apache2 restart ``` -------------------------------- ### Get Latest Extension Details Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/versions.md Fetches details for the latest version of a specific Lucee extension, such as the S3 extension. The 'lex' property contains the installation URL. ```javascript versions = LuceeExtension("org.lucee", "s3-extension"); latest = versions[len(versions)]; detail = LuceeExtension("org.lucee", "s3-extension", latest); writeOutput("Install from: " & detail.lex); ``` -------------------------------- ### LuCLI AI Configuration Commands Source: https://github.com/lucee/lucee-docs/blob/master/docs/technical-specs/lucli-spec.md Commands for managing AI configurations, including adding, listing, and setting defaults. Use `--guided` for interactive setup. ```sh lucli ai config add [--guided] [--name n] [--type openai] [--model gpt-4o] [--secret-key '#env:KEY#'] ``` ```sh lucli ai config list [--show] ``` ```sh lucli ai config defaults [--default-endpoint n] [--default-model n] [--show] ``` -------------------------------- ### Iterate and Transform Struct Data with Reduce Source: https://github.com/lucee/lucee-docs/blob/master/docs/03.reference/05.objects/struct/reduce/_examples.md Use the 'reduce' member function to iterate over a struct, transforming its values into an HTML list. This example requires no special setup. ```luceescript animals = { cow: {noise: "moo", size: "large"}, pig: {noise: "oink", size: "medium"}, cat: { noise: "meow", size: "small"} }; dump(label: "All animals", var: animals); animalInfo = animals.reduce(function(result, key, value) { return arguments.result & "
  • " & arguments.key & "
    • Noise: " & arguments.value.noise & "
    • Size: " & arguments.value.size & "
  • "; }, "
      ") & "
    "; // Show result echo(animalInfo); ``` -------------------------------- ### Host Configuration with Multiple Aliases Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/10.lucee-server-adminstration-windows/05.utilizing-Tomcat-server-xml-file/page.md This example demonstrates how to configure a Host with multiple domain aliases. This allows the same website to be accessed using different domain names. ```xml www.lucee.org web.lucee.org lucee.org ``` -------------------------------- ### Specifying Transaction Isolation Level Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/database-connection-management.md This example shows how to specify a transaction isolation level when starting a transaction block. Available levels include read_uncommitted, read_committed, repeatable_read, and serializable. ```javascript // Specify isolation level for the transaction transaction isolation="read_committed" { // Queries here execute with READ COMMITTED isolation queryExecute("SELECT * FROM accounts WHERE account_id = ?", [accountId]); } ``` -------------------------------- ### AI Utility Common Methods Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/extension-utilities.md Examples of using the AI utility to get available model names and AI metadata. The `null` argument for `getModelNames` indicates default behavior. ```java // Get available AI model names String[] models = ai.getModelNames(null); // Get AI metadata Struct metadata = ai.getAIMetadata(pc, "mychatgpt", false); ``` -------------------------------- ### Extracting Array Elements with slice() Source: https://github.com/lucee/lucee-docs/blob/master/docs/03.reference/05.objects/array/slice/_examples.md Use the slice() method to get a shallow copy of a portion of an array. It takes a start index and an optional end index. Indices are 0-based. ```luceescript myarray = ["one","two","three","TWO","five","Two"]; res = myarray.slice(2,4); writedump(res); myarray = ["one","two","three","TWO","five","Two"]; res = myarray.slice(3,4); writedump(res); ``` -------------------------------- ### Basic Host and Context Configuration Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/10.lucee-server-adminstration-windows/05.utilizing-Tomcat-server-xml-file/page.md A simplified example of a Host and Context configuration for server.xml. This configuration specifies the domain name and the base directory for the website's files. ```xml ``` -------------------------------- ### Start CommandBox Server with Configuration Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/05.installation-linux/08.linux-install-ubuntu-commandbox/page.md Execute this command to start the CommandBox server using the specified server.json configuration file as the 'cfbox' user. The '--console' flag outputs server data to the console. ```bash $ sudo -H -u cfbox box server start /var/www/wwwroot/server.json --console ``` -------------------------------- ### Getting Lucee Scopes from Java Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/32.tutorial-lucee/02.tutorial-java-in-lucee/01.using-lucee-in-java/page.md Provides examples of how to retrieve references to Lucee's core scopes (variables, request, session, application) directly from Java code using the PageContext object. ```java Scope variablesScope = pc.variablesScope(); Scope requestScope = pc.requestScope(); Scope sessionScope = pc.sessionScope(); Scope applicationScope = pc.applicationScope(); ``` -------------------------------- ### Basic AI Session Serialization and Restoration Example Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/ai-serialisation.md Demonstrates creating an AI session, serializing it, saving it, and then restoring it with a different AI model. This showcases cross-model flexibility and context preservation. ```cfml // Create and use an AI session claudeSession = LuceeCreateAISession(name:'claude', systemMessage:"Answer as succinctly as possible."); response = LuceeInquiryAISession(claudeSession, "What is the capital of France?"); // Serialize session to JSON string serializedData = SerializeAISession(claudeSession); // Save to database, file, etc. fileWrite(myAISession, serializedData); // ... Later, in another request ... // Restore the session with complete history // Note that we're using 'chatGPT' here instead of 'claude' serializedData = fileRead(myAISession); restoredSession = LoadAISession('chatGPT', serializedData); // Continue conversation with context preserved, but now using ChatGPT response = LuceeInquiryAISession(restoredSession, "What is the capital of Switzerland?"); ``` -------------------------------- ### Docker Compose for Lucee and Nginx Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/docker.md Example Docker Compose configuration defining Lucee and Nginx services for a reverse proxy setup. Mounts local directories for web content and Lucee configuration. ```yaml version: "3" services: lucee: image: lucee/lucee:latest ports: - "8888:8888" volumes: - ./www:/var/www - ./config/lucee:/opt/lucee/web nginx: image: nginx:latest ports: - "80:80" volumes: - ./nginx.conf:/etc/nginx/nginx.conf depends_on: - lucee ``` -------------------------------- ### FTP File System Example Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/16.file-system/page.md Illustrates accessing a file on an FTP server, including authentication with username and password. ```lucee ftp://myUsername:myPassword@somehost/pub/downloads/somefile.zip ``` -------------------------------- ### Create Tomcat Startup Script Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/02.installing-lucee/03.osx/01.installing-tomcat-and-lucee-on-os-x-using-the-lucee-war-file/page.md Create a startup script for Tomcat, setting CATALINA_HOME and CATALINA_BASE. Replace with your macOS username. ```bash #!/bin/bash # set the path to Tomcat binaries export CATALINA_HOME=/Users//tomcat # set the path to the instance config export CATALINA_BASE=/Users//tomcat EXECUTABLE=${CATALINA_HOME}/bin/catalina.sh exec $EXECUTABLE run ``` -------------------------------- ### Using Imported Custom Tags in CFML Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/custom-tags-via-extensions.md After installing an extension that places tags in `context/mytags/`, you can import and use them with a custom prefix like 'ui'. This example demonstrates using custom Button, Form, and Input tags. ```cfml ``` -------------------------------- ### Quick Start: Load POI with Component Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/maven.md This example demonstrates loading the Apache POI library for reading Excel files within a specific component. Lucee automatically downloads the specified Maven artifact and its dependencies. ```cfml component javaSettings='{"maven":["org.apache.poi:poi-ooxml:5.2.5"]}' { import org.apache.poi.xssf.usermodel.XSSFWorkbook; import java.io.FileInputStream; function readFirstCell( path ) { var workbook = new XSSFWorkbook( new FileInputStream( arguments.path ) ); var sheet = workbook.getSheetAt( 0 ); return sheet.getRow( 0 ).getCell( 0 ).getStringCellValue(); } } ``` -------------------------------- ### CFML Loop and Query Examples Source: https://github.com/lucee/lucee-docs/blob/master/docs/03.reference/02.tags/output/_examples.md Demonstrates a basic cfloop, query creation using queryNew, and various cfoutput methods for displaying query data including limiting rows and grouping. ```lucee #i#
    #test.name# #test.age#
    #test.name# #test.age#

    #test.name# #test.age# ``` -------------------------------- ### Configure Undertow Servlet Deployment Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/servlet-configuration.md This Java code configures Undertow to deploy Lucee. Ensure correct imports and classpath setup. It defines servlets for .cfm and .cfc files and starts the server on port 8080. ```java DeploymentInfo servletBuilder = Servlets.deployment() .setClassLoader(MyApp.class.getClassLoader()) .setContextPath("/") .setDeploymentName("lucee.war") .addServlets( Servlets.servlet("CFMLServlet", CFMLServlet.class) .addMapping("*.cfm") .addMapping("*.cfc") .setLoadOnStartup(1) ); DeploymentManager manager = Servlets.defaultContainer() .addDeployment(servletBuilder); manager.deploy(); Undertow server = Undertow.builder() .addHttpListener(8080, "0.0.0.0") .setHandler(manager.start()) .build(); server.start(); ``` -------------------------------- ### Configure JVM Startup Argument Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/external-agent.md Add the agent to your JVM startup arguments using the -javaagent flag. Specify the correct path to the agent JAR. ```bash -javaagent:/path/to/lucee-external-agent.jar ``` -------------------------------- ### Create QR Code using Java Libraries Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/java-libraries.md This example demonstrates creating a QR code by utilizing imported Java classes for configuration, generation, and file writing. It shows instantiation of Java objects and static method calls. ```cfml public static void function createQR( String data, String path, numeric height, numeric width ) { // Configure QR code options using Java's HashMap var hints = new HashMap(); hints.put( EncodeHintType::ERROR_CORRECTION, ErrorCorrectionLevel::L ); // Generate the QR code matrix var matrix = new MultiFormatWriter().encode( data, BarcodeFormat::QR_CODE, width, height ); // Write to file - static method call with :: MatrixToImageWriter::writeToFile( matrix, listLast( path, "." ), new File( path ) ); } ``` -------------------------------- ### Build and Run Lucee Secret Provider with Docker Compose Source: https://github.com/lucee/lucee-docs/blob/master/examples/docker/secret-provider/readme.md Build the Docker image for the Lucee secret provider and then start all services using Docker Compose. This setup includes Lucee and LocalStack for mocking AWS services. ```bash # Build the image first docker build -t lucee-secret-provider . # Then start all services docker compose up -d ``` -------------------------------- ### HTTP File System Examples Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/16.file-system/page.md Provides examples of accessing files via HTTP, showing both basic access and authenticated access with username and password. ```lucee http://somehost:8080/downloads/pic.gif ``` ```lucee http://myUserName:myPassword@myHost/index.html ``` -------------------------------- ### Basic Setup: Set Query Result Threshold Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/query-result-threshold.md Set a threshold of 10,000 rows to catch moderately large result sets. This can be done via environment variable or as a Java system property when starting the Lucee application. ```bash # Environment variable export LUCEE_QUERY_RESULT_THRESHOLD=10000 ``` ```bash # Or as system property java -Dlucee.query.result.threshold=10000 -jar lucee.jar ``` -------------------------------- ### Run Local Lucee Extension Tests Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/05.working-with-source/05.building-and-testing-extensions/page.md This batch script compiles the extension using Ant, starts a Lucee instance, installs the extension, and runs tests with specific labels. Ensure Lucee and script-runner are checked out to the correct directories. ```batch call ant if %errorlevel% neq 0 exit /b %errorlevel% set testLabels=s3 set testFilter= ant -buildfile="C:\work\script-runner" -DluceeVersion="6.0.0.300-SNAPSHOT" -Dwebroot="C:\work\lucee6\test" -Dexecute="/bootstrap-tests.cfm" -DextensionDir="C:\work\lucee-extensions\extension-s3\dist" ``` -------------------------------- ### Lucee Application.cfc Default Template Source: https://github.com/lucee/lucee-docs/blob/master/docs/recipes/application-cfc.md This is a comprehensive Application.cfc template for Lucee CFML. It includes commented-out examples for common application settings like name, locale, timezone, character sets, timeouts, and session management. Use this as a starting point for your Lucee application configuration. ```cfs component displayname="Application" output="false" hint="Handle the application" { /*************************************************************************** * INTRODUCTION **************************************************************************** * This Application.cfc template should serve as a * starting point for your applications settings running * with Lucee CFML engine. * * The settings/definitions are set as comments and represent Lucees default * settings. Some settings/definitions should only serve as helping * examples, e.g. datasources, mailservers, cache, mappings * * When creating an Application.cfc for the first time, you can configure * all the settings within the Lucee Server or Web Administrator * and use its "Export" tool ( Lucee Adminisitrator => Settings => Export ) * to move (by copy and paste) the settings to your Application.cfc. * * For further reference please see the following documentation at: * https://docs.lucee.org/categories/application.html * https://docs.lucee.org/guides/cookbooks/application-context-basic.html * https://docs.lucee.org/reference/tags/application.html * https://docs.lucee.org/guides/Various/system-properties.html * ***************************************************************************/ //////////////////////////////////////////////////////////////// // APPLICATION NAME // Defines the name of your application //////////////////////////////////////////////////////////////// // this.name = "myApplication"; //////////////////////////////////////////////////////////////// // LOCALE // Defines the desired time locale for the application //////////////////////////////////////////////////////////////// // this.locale = "en_US"; //////////////////////////////////////////////////////////////// // TIME ZONE // Defines the desired time zone for the application //////////////////////////////////////////////////////////////// // this.timezone = "Europe/Berlin"; //////////////////////////////////////////////////////////////// // WEB CHARSET // Default character set for output streams, form-, url-, // and // cgi scope variables and reading/writing the header //////////////////////////////////////////////////////////////// // this.charset.web="UTF-8"; //////////////////////////////////////////////////////////////// // RESOURCE CHARSET // Default character set for reading from/writing to // various resources //////////////////////////////////////////////////////////////// // this.charset.resource="windows-1252"; //////////////////////////////////////////////////////////////// // APPLICATION TIMEOUT // Sets the amount of time Lucee will keep the application scope alive. //////////////////////////////////////////////////////////////// // this.applicationTimeout = createTimeSpan( 1, 0, 0, 0 ); //////////////////////////////////////////////////////////////// // SESSION TYPE // Defines the session engine // - Application: Default cfml sessions // - JEE: JEE Sessions allow to make sessions over a cluster. //////////////////////////////////////////////////////////////// // this.sessionType = "application"; //////////////////////////////////////////////////////////////// // SESSION MANAGEMENT // Enables/disables session management //////////////////////////////////////////////////////////////// // this.sessionManagement = true; //////////////////////////////////////////////////////////////// // SESSION TIMEOUT // Sets the amount of time Lucee will keep the session scope alive. //////////////////////////////////////////////////////////////// // this.sessionTimeout = createTimeSpan( 0, 0, 30, 0 ); //////////////////////////////////////////////////////////////// // SESSION STORAGE // Default Storage for Session, possible values are: // - memory: the data are only in the memory, so in fact no persistent storage // - file: the data are stored in the local filesystem // - cookie: the data are stored in the users cookie // - : name of a cache instance that has "Storage" enabled // - : name of a datasource instance that has "Storage" enabled //////////////////////////////////////////////////////////////// // this.sessionStorage = "memory"; ``` -------------------------------- ### Getting a Java Enum Value by String Name Source: https://github.com/lucee/lucee-docs/blob/master/docs/04.guides/13.Various/32.tutorial-lucee/02.tutorial-java-in-lucee/page.md Use the `valueOf( String )` method on a Java Enum class to retrieve an Enum instance based on its string name. This is useful for dynamically obtaining Enum values, for example, from configuration settings or method arguments, and then passing them to Java methods or constructors. ```lucee ``` -------------------------------- ### Output Examples for bitMaskSet() Source: https://github.com/lucee/lucee-docs/blob/master/docs/03.reference/01.functions/bitmaskset/_examples.md Demonstrates the output of the bitMaskSet() function with different parameters. Ensure the Lucee environment is set up to execute these scripts. ```luceescript writeOutput(bitMaskSet(255, 255, 5, 5)); writeOutput("
    "); writeOutput(bitMaskSet(255, 15, 0, 4)); ```