How can I return binary data as part of a REST extension?

Hi,

I was trying to return binary data as part of a REST extension and am finding that even though the org.bonitasoft.web.extension.rest.RestApiResponseBuilder allows for a Serializable object as the response payload, the implementation appears to call toString() on the response object.
Placing binary data in a String subjects it to character encoding/corruption -- a Serialized object would have been perfect.

Looking at the https://github.com/bonitasoft/bonita-web-extensions/blob/master/src/main/java/org/bonitasoft/web/extension/rest/RestApiResponse.java, I have to provide a serializable.

Is it possible to send back my binary data as a serializable? How?
How can I return binary data as part of a REST extension?
How can I access the HttpServletResponse to send my binary data back?

Can you provide an example?

Thank you!

 

 

Hi,

REST API Extensions do not support sending binary data payloads.
Do not hesitate do add this idea to the list if you’d like to see it implemented !

HTH
Romain