CFC Remoting: Is there a way to output HTML instead of plain text?


#1

In Adobe ColdFusion, when you call a CFC method remotely with a returnFormat of “plain”, the server renders HTML to the browser. I can confirm this with the response headers:

Content-Type: text/html;charset=UTF-8

In Lucee however, when I call a CFC method remotely with the same returnFormat property, the server renders the result as plain text. In Lucee I get the following response header:

Content-Type: text/plain;charset=UTF-8

Is there a way to have Lucee treat the generated output as HTML? Here’s some sample code within the CFC I’m calling:

<cffunction name="page" access="remote" returnformat="plain">
    <cfoutput><h1>Hello World</h1></cfoutput>
</cffunction>

Notes: I’m using Lucee 5.2.8.50