- From: Anselm Baird_Smith <Anselm.Baird_Smith@sophia.inria.fr>
- Date: Mon, 4 Aug 1997 09:15:01 +0200 (MET DST)
- 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 UTC