0

I've a task to stream a file coming from backend.

  • i'm using spring RestTemplate the Exchange method of RestTemplate returns Response Entity with content type Octet-Stream binary data

  • using ajax call from the JSP to call resource portlet in the liferay controller to stream the files

my problem in the controller itself as i've did alot of trials to make the file streams, i'm receiving the data but in the network traffic only and nothing appears in the browser and noting worked, anyone can advice on that I've wasted days to fix that but not succeeded.

code trails

IOUtils.copy(myInputStream, response.getPortletOutputStream());

and

response.setProperty("Content-Disposition", "attachment;

filename='filename.pdf'");



response.setContentType("application/octet-stream");



out.write(responseEntity.getBody());

in JSP Ajax call

$.ajax(
    {
        url : getFileStreamURL+'&documentName='+encodeURI(documentName),
        type: "GET",
        data : null,
        success:function(data) 
        {

        }
    });
Mahmoud Ismail
  • 187
  • 1
  • 3
  • 12

0 Answers0