Re: WOResponse large http file download
Re: WOResponse large http file download
- Subject: Re: WOResponse large http file download
- From: Jürgen Tabert <email@hidden>
- Date: Fri, 25 Jan 2013 13:28:40 +0100
I did some tests using a 9GB file
1. Direct Access (Direct Action) works
2. download using the htdocs folder (Apache 2.2) works
3. download using mod_webobjects (Apache 2.2) fails - only ~2GB gets downloaded
Maybe there is a problem in the code of the apache module or I miss an configuration option.
The download stops exactly at the size of an signed integer.
On 24.01.2013, at 18:48, Fabian Peters <email@hidden> wrote:
> Hi Niek,
>
> I'm late to the party, but: Are you using Apache 1.3.X? I seem to remember that it has a relatively low size limit of its own.
>
> Fabian
>
> Am 21.01.2013 um 12:59 schrieb niek:
>
>> I tried this exact same code, and it doesn't work here.
>> The file does not get fully downloaded. I'm trying to download a 7GB zip file, and only 2.808.905 bytes (2.8GB) gets downloaded.
>>
>>
>> Niek Vervaeke
>> Vit2Print.com
>>
>> On 19 Jan 2013, at 16:17, Jürgen Tabert wrote:
>>
>>> works for me (DirectAction)
>>>
>>> WOResponse response = new WOResponse();
>>>
>>> File fileToDownload = new File(po.filePath());
>>>
>>> String contentDisposition = "attachment; filename=\"" + po.fileName() + "\"";
>>> response.setHeader(contentDisposition, "content-disposition");
>>> response.setHeader("application/octet-stream", "content-type");
>>> response.setHeader(String.valueOf(fileToDownload.length()),"content-length");
>>> ...
>>>
>>> response.setContentStream(new FileInputStream(fileToDownload), 4096, fileToDownload.length());
>>>
>>> return response;
>>>
>>>
>>> On 18.01.2013, at 11:35, niek <email@hidden> wrote:
>>>
>>>> I also get a SocketException at the end of the download.
>>>>
>>>> 18/01/2013 11:27:07:597 [OFF] <WorkerThread14> NSLog.java.appendln -> <WOWorkerThread id=14 socket=Socket[addr=/192.168.168.14,port=62455,localport=8889]> Exception while sending response: java.net.SocketException: Broken pipe
>>>>
>>>>
>>>> I doesn't seem like a time-out problem because when I download the same file from different servers it downloads the same amount of bytes in different times.
>>>>
>>>>
>>>> On 18 Jan 2013, at 11:14, niek wrote:
>>>>
>>>>> New example code:
>>>>>
>>>>> public WOActionResults TestAction() throws java.io.FileNotFoundException {
>>>>> WOResponse response = new WOResponse();
>>>>> response.setHeader("application/x-document", "content-type");
>>>>>
>>>>> File file = new File("/test.zip");
>>>>>
>>>>> response.setHeader("attachment; filename=\"" + file.getName() + "\"", "content-disposition");
>>>>> response.setContentStream(new FileInputStream(file), 4096, file.length());
>>>>> return response;
>>>>> }
>>>>>
>>>>> the setContentStream method accepts long as content length since WO 5.4, so I guess this should work for large files?
>>>>> If not, how can I support large file downloads?
>>>>>
>>>>> On 18 Jan 2013, at 11:09, Alexander Spohr wrote:
>>>>>
>>>>>> I think you are wrapping around maxint.
>>>>>> Your example code is incomplete. It can not work...
>>>>>>
>>>>>>
>>>>>> Am 18.01.2013 um 09:58 schrieb niek <email@hidden>:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I'm experiencing a problem when trying to download files larger than 4GB over http but only a part is downloaded.
>>>>>>> When I try to download a 32GB file, only 3,98GB (3980070495 bytes) is downloaded. When I try to download a 7GB file, only 2,7GB is downloaded.
>>>>>>> I have retried it several times, and the result was always the same.
>>>>>>>
>>>>>>> Example code:
>>>>>>>
>>>>>>> public WOActionResults DownloadAction() {
>>>>>>> WOResponse response = new WOResponse();
>>>>>>> response("application/x-document", "content-type");
>>>>>>>
>>>>>>> File file = new File("/test.zip");
>>>>>>>
>>>>>>> response("attachment; filename=\"" + file.getName() + "\"", "content-disposition");
>>>>>>> response(new FileInputStream(file), 4096, file.length());
>>>>>>> return response;
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> I'm using WebObjects 5.4.3, so since 5.4 the content-length in WOResponse.setContentStream is of type long.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Vit2Print.com NV
>>>>> Tieltstraat 167
>>>>> 8740 Pittem
>>>>> Belgium
>>>>> Phone : +32 51 42 40 15
>>>>> Fax : +32 51 40 29 22
>>>>> Web : www.vit2print.com
>>>>>
>>>>>
>>>>> <Mail Attachment.jpeg><Mail Attachment.jpeg>
>>>>>
>>>>>
>>>>> <Mail Attachment.jpeg>
>>>>>
>>>>>
>>>>>
>>>>> ___________________________________________________________________________
>>>>> This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information and/or information protected by intellectual property rights.
>>>>> If you are not the intended recipient, please note that any review, dissemination, disclosure, alteration, printing, copying or transmission of this e-mail and/or any file transmitted with it, is strictly prohibited and may be unlawful.
>>>>> If you have received this e-mail by mistake, please immediately notify the sender and permanently delete the original as well as any copy of any e-mail and any printout thereof.
>>>>> We may monitor e-mail to and from our network.
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Webobjects-dev mailing list (email@hidden)
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>
>>>>> This email sent to email@hidden
>>>>
>>>>
>>>>
>>>> Vit2Print.com NV
>>>> Tieltstraat 167
>>>> 8740 Pittem
>>>> Belgium
>>>> Phone : +32 51 42 40 15
>>>> Fax : +32 51 40 29 22
>>>> Web : www.vit2print.com
>>>>
>>>>
>>>> <Mail Attachment.jpeg><Mail Attachment.jpeg>
>>>>
>>>>
>>>> <Mail Attachment.jpeg>
>>>>
>>>>
>>>>
>>>> ___________________________________________________________________________
>>>> This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information and/or information protected by intellectual property rights.
>>>> If you are not the intended recipient, please note that any review, dissemination, disclosure, alteration, printing, copying or transmission of this e-mail and/or any file transmitted with it, is strictly prohibited and may be unlawful.
>>>> If you have received this e-mail by mistake, please immediately notify the sender and permanently delete the original as well as any copy of any e-mail and any printout thereof.
>>>> We may monitor e-mail to and from our network.
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list (email@hidden)
>>>> Help/Unsubscribe/Update your Subscription:
>>>>
>>>> This email sent to email@hidden
>>>
>>>
>>>
>>>
>>> -----------------------------------------------------------------------------------------------------------------------------------------------------------------
>>> H&T Greenline GmbH, Grünstraße 8, 16775 Gransee
>>> Geschäftsführung: Andreas Hirtzel, Jürgen Tabert
>>> Amtsgericht NeuruppinHRB 5334
>>> http://www.htgreenline.de/terms.aspx
>>>
>>
>>
>>
>> Vit2Print.com NV
>> Tieltstraat 167
>> 8740 Pittem
>> Belgium
>> Phone : +32 51 42 40 15
>> Fax : +32 51 40 29 22
>> Web : www.vit2print.com
>>
>>
>> <Mail-Anhang.jpeg><Mail-Anhang.jpeg>
>>
>>
>> <Mail-Anhang.jpeg>
>>
>>
>>
>> ___________________________________________________________________________
>> This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information and/or information protected by intellectual property rights.
>> If you are not the intended recipient, please note that any review, dissemination, disclosure, alteration, printing, copying or transmission of this e-mail and/or any file transmitted with it, is strictly prohibited and may be unlawful.
>> If you have received this e-mail by mistake, please immediately notify the sender and permanently delete the original as well as any copy of any e-mail and any printout thereof.
>> We may monitor e-mail to and from our network.
>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden