Re: WOResponse setContentStream help needed (variable length data)
Re: WOResponse setContentStream help needed (variable length data)
- Subject: Re: WOResponse setContentStream help needed (variable length data)
- From: Helmut Tschemernjak <email@hidden>
- Date: Tue, 15 Jul 2003 16:56:49 +0200
Dear David,
the filter FilterInputStream stream works great. I just throw an
IOException if the read returns -1 and the setContentStream stops.
For the stream size I provide an estimate which is larger than the final
content.
thank you for your help.
best regards / mit freundlichen Gruessen,
Helmut Tschemernjak
HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Phone: +49-5131-709320
Fax: +49-5131-709325
Internet Mail: email@hidden
Internet Web: http://www.helios.de
David Neumann wrote:
Stream to a temp file. Then you will know the length. Then you can
stream from that file in WOResponse, deleting the file when the response
is done.
You can tell the response is done by overriding close on your own
InputStream that you assign to the WOResponse. Here's more about that
from the docs:
The InputStream will be closed after the response is returned to the
client, or if an exception is thrown while sending the response. If you
want custom logic to be invoked at that point, create a custom
FilterInputStream to wrap the InputStream source and override the close
method. However, note that the close() will be invoked after the entire
request-response loop has finished; thus references to resources that
need to be cleaned up must be carefully managed. Also be cautious during
the clean-up itself, as some resources may have changed state. For
instance, the defaultEditingContext of a session may have already been
unlocked.
d
On Monday, July 14, 2003, at 03:26 PM, Helmut Tschemernjak wrote:
Hello,
I reading variable length data from a socket and forward it into the
response without knowing how many bytes will come.
I tested the setContentStream, but it requires the size of the stream
which is unknown to me.
At present I read in data completely into an byte array and use
setContent(new NSData(b)) which means the data will be copied again an
NSData object.
Is there any chance to stream a response without knowing the length?
Is there a way get the socket connection to send the response directly?
PS: I talking about several hundred megabytes of data.
best regards / mit freundlichen Gruessen,
Helmut Tschemernjak
HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Phone: +49-5131-709320
Fax: +49-5131-709325
Internet Mail: email@hidden
Internet Web: http://www.helios.de
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
--
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.