W3C home > Mailing lists > Public > www-jigsaw@w3.org > July to August 1997

Multipart/x-mixed-replace

From: Anselm Baird_Smith <Anselm.Baird_Smith@sophia.inria.fr>
Date: Mon, 4 Aug 1997 09:15:01 +0200 (MET DST)
Message-Id: <199708040715.JAA26850@www43.inria.fr>
To: Nirmalkumar - Patil <npatil@cs.tamu.edu>
Cc: www-jigsaw@w3.org
npatil@cs.tamu.edu writes:
 > 
 > Hello All,
 > 
 > I am trying to have Jigsaw support the multipart/x-mixed-replace MIME type.
 > In order to be able to do this, I tried to obtain a reference to the 
 > DataOutputStream and directly write to the underlying stream ... 
 > However I end up screwing the headers for the HTTP response....
 > 
 > How do I get a reference to the DataOutputStream after the headers have been
 > written to the stream... so that i have only to write the delimiters
 > and the data between these to the stream.
 > 
 > is there a better or simpler way to do this ? Since I would like to sleep 
 > between segments of the mixed data... hence i don't see any other way rather 
 > than writing directly to the DataOutputStream to the client.  

The way I would do it would be the following:

a) Get the request compute a set (say an array) of replies.
b) Create a MultipartOutputStream that akes as parameters an array of
   replies, and which will loop through them doing:
     0) Emit multipart headers
     i)   replies[i].emit(out) // Emit that reply chunk headers
     ii)  dump replies[i] input stream to out

Ultimate your code should look like:

    public Reply get(Request request) {
        Reply replies[] = computeReplies(request);
        Reply theReply  = new MultipartOutputStream(replies);
        return theReply;
    }

[btw If ever you write MultipartOutputStream class, let me know..]

Anselm.
Received on Monday, 4 August 1997 03:15:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:26 GMT