IS service to return a file to browser client

The SetResponseSample package shows how a service can return the contents of a file to any HTTP client. This is a very useful capability.

The one downside is that it requires the data to be completely loaded into memory, which for large files is a bad idea.

I’m hoping someone, perhaps someone at wM, knows of a technique that can be used to return large files. A “setResponseStream” if you will.

I’ve a used custom content handler in the past to provide this sort of capability but I’m hoping a less-intrusive approach is available. Plus, I cannot seem to locate the code that I used to do that so I need a new approach in any case. :slight_smile:

Never tried this Rob.Will find out in my circle also and see if any reusable exist suiting this requirement.

-RMg

Hello,

I’m currently trying to implement that solution so I was wondering if you had solve your problem and if you could share the solution ?

regards,
mathieu

Found for PDF files.

Instead of using the output template I used the setResponse service in flow.
This way I could specify :

  • The response content (PDF transform to string)
  • The content-type : application/pdf
  • The encoding : ISO-8859-1

The browser get the answer back and display the PDF.
If you set other content-type for files you should be able to download files.

Unfortunatly, for large file I don’t have the answer (not using a stream).

regards,
mathieu