Harjinder - can you try a smallish file - like 5 megs - and confirm that that 
works and maybe only breaks when you have something bigger than 2 gigs?

AARON ROSENZWEIG / Chat 'n Bike <http://www.chatnbike.com/>
e:  [email protected] <mailto:[email protected]>  t:  (301) 956-2319        
        
        

> On May 7, 2019, at 4:08 PM, Harjinder Singh <[email protected]> 
> wrote:
> 
> As per the logs everything is ok. No errors.
> It found the correct file and seems to be setting the content stream with 
> correct size.
> 
> Thanks,
> Harjinder Singh | Sr. Programmer Analyst
> PortfolioAid
> t. 416-479-4413 | e. [email protected]
> a. 166 Pearl Street, Suite 200 Toronto, ON M5H 1L3
> 
> -----Original Message-----
> From: Jesse Tayler [mailto:[email protected]] 
> Sent: Tuesday, May 7, 2019 3:50 PM
> To: Aaron Rosenzweig <[email protected]>
> Cc: Harjinder Singh <[email protected]>; Ruveen de Lanerolle 
> <[email protected]>; [email protected]
> Subject: Re: Problem Downloading Large Files
> 
> Did you check the logs?
> 
> 
> 
>> On May 7, 2019, at 3:35 PM, Aaron Rosenzweig <[email protected]> wrote:
>> 
>> That is unfortunate because that code works for me. 
>> 
>> There must be some other issue going on. 
>> AARON ROSENZWEIG / Chat 'n Bike
>> e:  [email protected]  t:  (301) 956-2319          
>>      
>> 
>>> On May 7, 2019, at 3:29 PM, Harjinder Singh <[email protected]> 
>>> wrote:
>>> 
>>> Hi Aaron,
>>> 
>>> This did not work. When I download the file is always 0KB.
>>> 
>>> Thanks,
>>> Harjinder Singh | Sr. Programmer Analyst PortfolioAid t. 416-479-4413 
>>> | e. [email protected] a. 166 Pearl Street, Suite 200 
>>> Toronto, ON M5H 1L3
>>> 
>>> 
>>> From: Aaron Rosenzweig [mailto:[email protected]] On Behalf 
>>> Of Aaron Rosenzweig
>>> Sent: Friday, May 3, 2019 5:48 PM
>>> To: Leigh Kivenko <[email protected]>
>>> Cc: Hugi Thordarson <[email protected]>; 
>>> [email protected]; Harjinder Singh 
>>> <[email protected]>; Ruveen de Lanerolle 
>>> <[email protected]>
>>> Subject: Re: Problem Downloading Large Files
>>> 
>>> Leigh,
>>> 
>>> See if this might help:
>>> 
>>> WOResponse aResponse = context().response(); 
>>> aResponse.setHeader("application/zip", "Content-Type"); 
>>> aResponse.setHeader("" + getZipFile().length() + "", 
>>> "Content-Length"); aResponse.setHeader("attachment;filename=\"" + 
>>> getZipFile().getName() + "\"","Content-Disposition"); FileInputStream 
>>> inputStream = new FileInputStream(getZipFile()); 
>>> aResponse.setContentStream(inputStream, 0, getZipFile().length()); 
>>> return aResponse;
>>> 
>>> AARON ROSENZWEIG / Chat 'n Bike
>>> e:  [email protected]  t:  (301) 956-2319
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On May 3, 2019, at 4:53 PM, Leigh Kivenko <[email protected]> wrote:
>>> 
>>> Thanks for the quick response Hugi.
>>> 
>>> We tried using FileInputStream with setContentStream. It was also giving 
>>> 0Kb files as well.
>>> 
>>> Leigh Kivenko | Chief Technology Officer PortfolioAid t. 416-479-0523 
>>> | e. [email protected]
>>> 
>>> This e-mail may be privileged and confidential. If you received this e-mail 
>>> in error, please do not use, copy or distribute it, but advise me 
>>> immediately (by return e-mail or otherwise), and delete the e-mail.
>>> 
>>> From: Hugi Thordarson [mailto:[email protected]]
>>> Sent: Friday, May 03, 2019 2:07 PM
>>> To: Leigh Kivenko <[email protected]>
>>> Cc: [email protected]
>>> Subject: Re: Problem Downloading Large Files
>>> 
>>> Hi Leigh,
>>> since the InputStream is called "byteIn" I'm guessing it's a 
>>> ByteArrayInputStream, meaning the data it contains has been loaded to 
>>> memory.
>>> If you have an actual file, you might consider using a FileInputStream 
>>> instead.
>>> 
>>> Cheers,
>>> - hugi
>>> 
>>> 
>>> On 3 May 2019, at 18:02, Leigh Kivenko <[email protected]> wrote:
>>> 
>>> Hi All,
>>> I was wondering if anyone has encountered this issue and has been able to 
>>> resolve it:
>>> 
>>> In one page of our web app, users have the ability to download files. We 
>>> are having an issue when the user attempts to download a large file (> 
>>> 500MB - zip), where the app throws an Out of Memory error. The download 
>>> functionality is coded by: 
>>> 1.       Converting the file to FileInputStream and then to NSData
>>> 2.       appending the file to the WOResponse.
>>> a.  response.appendContentData(fileNSData)
>>> 
>>> This approach is described here : 
>>> https://en.wikibooks.org/wiki/WebObjects/Web_Applications/Development
>>> /Examples/Return_a_File
>>> 
>>> We also tried using the following approach (also described in link above):
>>> 1.       Using ByteArrayInputStream 
>>> Ø  response.setContentStream(byteIn, 4096, length);
>>> 
>>> In both cases, the user receives a 0KB file.
>>> 
>>> Does anyone have any recommended approaches to serve a large file through 
>>> the application?  Please note the file lives on the application server but 
>>> for security purposes we wouldn’t want it directly accessible.
>>> 
>>> Thanks,
>>> Leigh Kivenko | Chief Technology Officer PortfolioAid t. 416-479-0523 
>>> | e. [email protected]
>>> 
>>> This e-mail may be privileged and confidential. If you received this e-mail 
>>> in error, please do not use, copy or distribute it, but advise me 
>>> immediately (by return e-mail or otherwise), and delete the e-mail.
>>> 
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/webobjects-dev/hugi%40karlmen
>>> n.is
>>> 
>>> This email sent to [email protected]
>>> 
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnb
>>> ike.com
>>> 
>>> This email sent to [email protected]
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/jtayler%40oeinc
>> .com
>> 
>> This email sent to [email protected]
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to