REST Functionality for XML/RSS in Lucee 5.2


We’re in the process of moving our website from Lucee 4.5 to version 5.2 and we have a number of custom RSS/XML feeds that rely on the component / function REST wiring functionality.

It seems like in Lucee 5.x, we can no longer return custom crafted XML from a rest function. Using the old 4.x code on Lucee 5, these rest functions that output XML now return nothing.

Playing around a bit and making changes to the code, I’m able to get a response output if I add produces="application/xml" to the function definition and have the XML content returned at the bottom of the function.

However, the result is the escaped XML (all of the tags are escaped as <…>)

If we remove produces and use returntype="xml" instead, we get the XML output but it’s surrounded in quotes as a string. In this case, the Content-Type header is set to “application/json;charset=UTF-8”.

We have a lot of services that currently rely on this functionality and with our timeline, completely rewriting isn’t an option.

If anyone has any ideas or tips as to how we can get custom XML out of the REST functions, please let us know. Thanks in advance!