Sending Binary Payloads in Direct REST Responses
You can send binary‑formatted data (for example, an image or audio file) as payloads in Direct REST responses.
A REST response with a binary payload is generated when the return type of the REST method is the
Use the
getImagePng(filename: String): Binary updating;
vars
file : File;
begin
addResponseHeaderField("Content-Type","image/png");
create file;
file.mode := File.Mode_Input;
file.kind := File.Kind_Binary;
file.fileName := "c:\somepath\" & filename;
return file.readBinary(file.fileLength());
epilog
delete file;
end;
The
Although you can reimplement the method to allow the application to post‑process the response, you must call the JadeRestService implementation to complete the processing.
2022.0.05 and higher
