0

Goal :- Send list of images and pdf from backend and display it in frontend.

What I tried :- I have created a servlet which sends the images and pdf in base64 format to frontend and in frontend i am using the base64 images as inline images to display it to customers.

Is there a better approach ? Because since base64 data is large the response payload is large. It seems this is slowing the website.

Is converting the base64 data to Blob in backend and sending it to frontend a better approach?

Codemaster
  • 145
  • 2
  • 13
  • 2
    Are you using any compression already? Your app server might do it automatically or you can use a GzipOutputStream or something like it. See this question: https://stackoverflow.com/questions/1862908/serve-gzipped-content-with-java-servlets – Cheshiremoe Jun 16 '22 at 19:59
  • @KJ If base64 is not good, what approach should i use to achieve my goal ? – Codemaster Jun 17 '22 at 09:12
  • @Cheshiremoe I am not using any compression. I have base64 data and i send the same to frontend but the payload is getting too large so i wanted to know if there is any alternate approach for this problem? – Codemaster Jun 17 '22 at 09:12

0 Answers0