By default, returning a binary file via a Controller’s method is quite simple, like:

However, this does NOT work if you try to return a text file like XML or an SVG image. It will end up in a Controller error.

Solution

Convert the text to binary:

 

 

  [email protected]