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 protected]> 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 protected]) > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/webobjects-dev/kevo%40gatorgraphics.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]
