Re: slow response of pdf
Re: slow response of pdf
- Subject: Re: slow response of pdf
- From: Pascal Robert <email@hidden>
- Date: Sat, 01 Nov 2014 16:48:04 -0400
Search the list’s archive, someone reported the same problem for Mavericks a couple of months ago.
> Hi Kevin,
>
> The reading is no problem, that takes only 8 seconds and is for the 10MB.
> But it takes 20 seconds to get the pdf to the browser with cgi and no time with direct connect.
>
> Frank
>
>
>> Op 1 nov. 2014, om 21:18 heeft Kevin <email@hidden> het volgende geschreven:
>>
>> I think you want to read more than one byte at a time. Try reading a block of bytes at a time. You can try different numbers and see where the sweet spot is.
>>
>> HTH,
>> Kevin
>>
>>
>>
>> On Nov 1, 2014, at 10:26 AM, Frank Stock <email@hidden> wrote:
>>
>>> Hi All,
>>>
>>> I have moved my application from MacOS server 10.6 to 10.9.5.
>>> I have done a complete new installation. The application works fine but when I create a pdf it takes about 25 seconds to see it in the browser.
>>> The pdf is about 10MB. When I do a direct connect I can see the pdf without delay.
>>>
>>> I have created a new Wonder Application with only the following code:
>>>
>>> public WOActionResults fichePrint() {
>>> String filename = "/tmp/test.pdf"; // test.pdf is a 10MB file
>>> ByteArrayOutputStream outputStream=null;
>>> try {
>>> outputStream = new ByteArrayOutputStream();
>>> InputStream inputStream = new FileInputStream(filename);
>>>
>>>
>>> int data;
>>> while( (data = inputStream.read()) >= 0 ) {
>>> outputStream.write(data);
>>> }
>>> inputStream.close();
>>> } catch (FileNotFoundException e) {
>>> // TODO Auto-generated catch block
>>> e.printStackTrace();
>>> } catch (IOException e) {
>>> // TODO Auto-generated catch block
>>> e.printStackTrace();
>>> }
>>>
>>> // It takes 8 seconds to load the file
>>> System.out.println("Read");
>>>
>>> WOResponse response=new WOResponse();
>>> response.setHeader("application/pdf", "Content-Type");
>>> response.setHeader(Integer.toString(outputStream.size()), "content-length");
>>> response.setHeader("inline; filename=test.pdf", "Content-Disposition");
>>> response.setContent(new NSData(outputStream.toByteArray()));
>>>
>>>
>>>
>>>
>>>
>>>
>>> return response;
>>> }
>>>
>>> Has this something to do with Apache? Where can I find more information to solve this?
>>>
>>> Thanks in advance,
>>> Frank Stock
>>> Belgium
>>>
>>>
>>> _______________________________________________
>>> 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