Anyway for render() in mapping to return binary data?

Bumping this thread. There are a lot of projects asking for the Cloud endpoint to allow for passing a binary in the render call.

here
here
and of course here where @JustinL calls out it is not supported and Local only.

It is not a size limitation, you can 'kinda of' get an image to pass by using base64 encoding like so:

def img = "<img src='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAg...much more'/>"
def html = "<html><head><title>Embedded Image</title></head><body>${img}</body></html>"
render contentType: "text/html", data: html, status: 200 

but when doing a true binary image render

byte[] imageBytes = [137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, much more]
render contentType: "image/gif", data: imageBytes

This works with the local api but not cloud api. It seems to have problems with the byte[] length?

Tagging @bravenel since it looks like @chuck.schwer is no longer active for help.

1 Like