Results 1 to 3 of 3
  1. #1
    dantestein is offline Member
    Join Date
    Oct 2008
    Rep Power

    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");
    outputStream = response.getOutputStream();

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


  2. #2
    strati1991 is offline Member
    Join Date
    Mar 2009
    Rep Power


    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

  3. #3
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Rep Power


    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.

Similar Threads

  1. video streaming
    By anniya0n in forum JDBC
    Replies: 3
    Last Post: 05-08-2013, 03:21 PM
  2. interrupting urlconnection's outputstream
    By zynasis in forum Networking
    Replies: 5
    Last Post: 10-02-2008, 12:49 AM
  3. Converting InputStream to OutputStream
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 01-11-2008, 11:13 PM
  4. HashMap to share OutputStream
    By gabriel in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2007, 05:47 PM
  5. PeerStream Audio Video Streaming Server 4.61
    By levent in forum Java Software
    Replies: 0
    Last Post: 07-31-2007, 07:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts