Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-10-2008, 10:57 PM
Member
 
Join Date: Oct 2008
Posts: 1
Rep Power: 0
dantestein is on a distinguished road
Default Outputstream not streaming.
In the following code, can anybody please tell me at what point the data actually starts to get transferred and the popup "download file" box appears? I'm thinking that the dialog box should appear on the first outputstream.write and start transferring data. But I don't think that's the case because the "Page cannot be displayed" is displayed after "waiting" for quite awhile. On a smaller dataset (shorter while loop) with less "wait", dialog box eventually appears and the data gets transferred properly. Larger dataset with longer wait always times out.

Is there some sort of a web server configuration that tells it to write out the data ONLY if outputstream closes? I But isn't the default Transport "chunked"? Could it be possible that the web server somehow got configured to never use "chunked"? If so, how would that happen? We're using Oracle AppServer 10g. Thanks - any help would be appreciated.

response.setHeader("Expires", "0");
response.setHeader("Content-disposition","inline;filename=Download.csv");
response.setContentType("application/x-msdownload");
outputStream = response.getOutputStream();

bufferInBytes = this.getData();
while (bufferInBytes != null)
{
outputStream.write(bufferInBytes, 0, bufferInBytes.length);
outputStream.flush();
bufferInBytes = this.getData();
}

outputStream.close();
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 03-13-2009, 08:00 PM
Member
 
Join Date: Mar 2009
Posts: 13
Rep Power: 0
strati1991 is on a distinguished road
Default
i wouldn't use flush everytime.
maybe you can use a PrintWriter i think that could work better.
you have to init it with PrintWriter(OutputStream out, true) ;
that means that the printWriter automatic flushes the data
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 03-14-2009, 07:36 AM
Senior Member
 
Join Date: Jan 2009
Posts: 319
Rep Power: 1
toadaly is on a distinguished road
Default
A flush *should* force a write by typical convention, but it's up to the API to follow typical practices or ignore them. Read the API doc for the class represented by "response" very carefully.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
interrupting urlconnection's outputstream zynasis Networking 5 10-02-2008 12:49 AM
video streaming anniya0n Database 1 01-24-2008 05:35 PM
Converting InputStream to OutputStream Java Tip Java Tips 1 01-11-2008 10:13 PM
HashMap to share OutputStream gabriel Advanced Java 1 08-06-2007 05:47 PM
PeerStream Audio Video Streaming Server 4.61 levent Java Announcements 0 07-31-2007 07:50 PM


All times are GMT +2. The time now is 09:54 AM.



VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org