Question

1
Replies
36
Views
StephenB3060 Member since 2017 4 posts
CGI
Posted: 5 months ago
Last activity: 5 months 3 weeks ago

Downloading very large files that don't reside on Pega server

Our Pega application provides users with the ability to download file attachments. These attachments are not stored within the Pega database but reside on network file share(s) within the same network domain as the Pega application server. 

We currently use the approach suggested in the below article after retrieving the Base64 representation of the attachment content using a web service.

https://community.pega.com/support/support-articles/unabe-download-file-server-path

While this works very effectively, we don't want to consume excessive memory on the server for files that could be over 1 Gigbayte in size. We will also run into WCF REST size limitations as files become larger.

Any existing Pega rule that I can find involves writing bytes to a file in the Pega ServiceExport directory and then utilizing some version of the sendFile() Pega engine API. What I want to avoid is streaming a file from a network file share to the Pega server and then streaming that back to the client browser (just takes too much time). There is an overload of the sendFile() api that takes a FileInputStream as an argument. Unfortunately, when I create an InputStream directly from file on the network file share, all I get is an empty file after the download. Perhaps there's a bug in that API or it was never intended to be used the way I am trying to use it.

Does anyone have any suggestions on how I can stream a file attachment directly from a network file share through an existing Pega Rule or API? I also found a pxHttpServletResponse property off the pxRequestor page but sadly this object always appears to be NULL. If not, I could try using it to stream the network file directly to the Servlet output stream. 

Pega Platform 8.1.1 Low-Code App Development
Share this page LinkedIn