Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multipart/x-mixed



You're right,  relying on connectionDidFinishLoading isn't appropriate for a multipart data source.  

Here's the basic life-cycle of multipart/x-mixed-replace:

didRecieveResponse:
didReceiveData:
...
didReceiveData:
didReceiveData:

didRecieveResponse:
didReceiveData:
...
didReceiveData:
didReceiveData:

1 - connection:didReceiveResponse: passing the original response; this response will have a Content-Type of x-mixed-replace
2 - a second -connection:didReceiveResponse: when we get the delimiter for the start of data; this response will carry the correct Content-Type
3 - some number of -connection:didReceiveData: calls; these datas should be concatenated and represent the content of the first frame
4 - a new -connection:didReceiveResponse: call when we get the delimiter for the second frame; note that theoretically the Content-Type could change from the prior call.  In practice, it does not, but that's because, well, servers don't do that
5 - some number of -connection:didReceiveData: calls containing the data for the new frame

And so on, repeat steps 4 & 5 ad nauseum.

This means in your didReceiveResponse method, if you have data, now would be the time to do any kind of processing on it.   And once you've done that, and you're done with the data,  make sure to clean up the old data, and prepare for the next set of data (eg., a new frame in an image)


Cheers,
Kevin


 
On Dec 6, 2005, at 5:34 AM, Jan DeVries wrote:

I am very, very new to webkit (and cocoa); first try. Books are on their way ;-)

Anyone know how to handle a 'Content-Type: multipart/x-mixed-replace' ?

I am trying NSURLConnection.
The question: how do you load the resulting data into an NSImage.
I get connectionDidFinishLoading only when the loading is finished. Which does not happen with multipart.... 
So i guess the question is: How can you detect when a part has been downloaded?

Or should i go for this with webView to?  webView though, represents a whole web page where i only want one image in my app and fix its size.

Any help and pointer will be appreciated.
Thanks,
Jan


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webkitsdk-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webkitsdk-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden

This email sent to email@hidden

References: 
 >multipart/x-mixed (From: Jan DeVries <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.