0

Could anyone provide a code example to show how to use Spring Rest to get binary data(say PDF or image) along with the JSON from server. I know how to down load PDF alone by using restful web service but don't see any sample code to retrieve binary date with additional info.

Thank you very much in advance!

user3593086
  • 43
  • 1
  • 6
  • 3
    Sharing your research helps everyone. Tell us what you've tried and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer! See also: [ask] – Spoody Apr 29 '18 at 15:05

1 Answers1

0

Refer my answer on sending PDF stored in Amazone S3

Change first 3 lines with File and FileInputStream API.

FileInputStream in = null;
in = new FileInputStream(new File("/file/path/acme.pdf"));
Red Boy
  • 5,429
  • 3
  • 28
  • 41
  • Thank you Red Boy for your response. I am afraid that I didn't say my question clearly. I want to develop a Spring Rest Service that will return below json object – user3593086 May 01 '18 at 01:15
  • I want to develop a Spring Rest Service that will return a json array [{"id":"123","binaryData":image},{"id":"456","binaryData":image},... ]. Thanks. – user3593086 May 01 '18 at 01:26