Hello,
Probably my ignorance, but I struggle to send a byte array (byte[]) from a java module to a restxq response.
Something a bit like this:
return (rest:response <http:response status="200"> <http:header name="content-type" value="application/pdf"/> </http:response> </rest:response>, SomeJavaModule:getSomeBytes($module_instance))
I know there is a binary module in BaseX but I tried various things and couldn't get the wanted output. I could probably write the bytes in a file and then use file:read-binary() but it's something I'd like to avoid.
Any clue here ?
Mickaël
Hi Mickaël,
You might need to convert the resulting byte sequence to a xs:base64Binary item:
convert:integers-to-base64( Q{java:java.lang.String}get-bytes('xyz') )
If that doesn’t help, feel free to provide us with your full RESTXQ function.
Best, Christian
On Thu, May 7, 2020 at 5:03 PM Mickael Desfrenes mickael.desfrenes@unicaen.fr wrote:
Hello,
Probably my ignorance, but I struggle to send a byte array (byte[]) from a java module to a restxq response.
Something a bit like this:
return (<rest:response> <http:response status="200"> <http:header name="content-type" value="application/pdf"/> </http:response> </rest:response>, SomeJavaModule:getSomeBytes($module_instance))
I know there is a binary module in BaseX but I tried various things and couldn't get the wanted output. I could probably write the bytes in a file and then use file:read-binary() but it's something I'd like to avoid.
Any clue here ?
Mickaël
basex-talk@mailman.uni-konstanz.de