Please, look at this differences between nsMultiMixedConv and my converter and tell me if could be this the reason of my problem:

a ) in SendData method of nsMultiMixedConv a StringInputStream is used:

    nsCOMPtr<nsIStringInputStream> ss(
do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv));
    rv = ss->ShareData(aBuffer, aLen);
    nsCOMPtr<nsIInputStream> inStream(do_QueryInterface(ss, &rv));
mFinalListener->OnDataAvailable(mPartChannel, mContext, inStream, offset, aLen);
                

b ) in SendData method of my converter I use a BufferedInputStream :

    rv = mCacheEntry->OpenInputStream(size, getter_AddRefs(in));
    nsCOMPtr<nsIInputStream> inStr;
    rv = mCacheEntry->GetDataSize(&size);
    rv = NS_NewBufferedInputStream(getter_AddRefs(inStr), in, size);
rv = mFinalListener->OnDataAvailable(mPartChannel, mContext, inStr, offset, size);



I call my method several times (as many times as different parts I receive) but it only shows what I have sent first.

1 ) Could be because of the use of BufferedInputStream?
2 ) How can I combine StringInputStream with the inputstream from the cache? ( I'm not familiarized at all with XPCOM tecniques )

please ... any answer will be helpful!!

thanks a lot

Mireia

        
Mireia Marcet wrote:
Hi,

I am a student from Spain. I am working on a project related to mobile communications and we are interested in sending webpages to mobiles as a one simple file. The mobile makes just one request and receives a kind of multipart/related file which contains the html part, the images, etc...

For this reason I've developed an streamconverter, similar to nsMultiMixedConverter, which divides the file into parts and stores them into the cache. At the end, it returns, to the httpchannel, the html part.

Now, in order to send back the html part to httpchannel at the beginning, I scan the html part (which is the first one) searching for the images that channel would request and I store "empty" images with this names into the cache. My idea is start showing the html and continue refreshing it once I continue obtaining and storing the nexts parts.

But (there is always a "but") I haven't achieved this second point. I don't know how to manage to reload or refresh the html showing the new (the real) images stored in the cache, instead of the first ones (the empty ones). Changing loadflags? (LOAD_RELOAD_BYPASS_CACHE? LOAD_REFRESH?) ...

any idea?

pd: I send the part to the httpchannel with a function very similar to SendData from nsMultiMixed

pd2: if you think that my work could be interesting for mozilla project just make me know. I will be very happy it helps and if anybody wants to continue it with me ;)



_______________________________________________
Mozilla-netlib mailing list
Mozilla-netlib@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-netlib

Reply via email to