This code is not perfect or tested, just typed it in here, but it should get you headed in the right direction
create a controller called OutputController.groovy
def viewFile = {
// add checks to ensure fileName parameter has no "/" or ".." to
// prevent directory transversal
def file = new File(OUTPUT_FILE_PATH + params?.fileName)
if (file.exists()) {
render(text: file.newInputStream().text, contentType: "text/plain",
encoding: "UTF-8")
} else {
render "FILE NOT FOUND: ${params?.fileName}"
}
}
update url mappings file
mappings {
"/output/$fileName?" {
controller = "output"
action = "viewFile"
}
}