internalRequest

Runs a request for a template inside the current Lucee server, without going over HTTP, and returns a struct with the response.

internalRequest(template [, method] [, urls] [, forms] [, cookies] [, headers] [, body] [, charset] [, addToken] [, throwonerror]) → returns struct

This function requires Lucee 6.0.0.161 and up.  Not supported on Adobe ColdFusion, etc.

Argument Reference

template string
Required

The template path to request, such as /test/index.cfm.

method string
Default: get

The HTTP method, such as GET or POST.

urls any

URL variables, as a struct or a name=value&name2=value2 string.

forms any

Form variables, as a struct or a name=value&name2=value2 string.

cookies struct

Cookies to send.

headers struct

Request headers to send.

body any

The request body.

charset string

The charset of the request. Defaults to the web charset.

addToken boolean
Default: false

When true, adds the session token as a cookie.

throwonerror boolean
Default: true

When true, an exception in the requested template is rethrown. When false, it is only reported in the result.

Examples
Sample code invoking the internalRequest function

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub