[EMAIL PROTECTED] wrote:
*A streamListener implementing the following functions : onStartRequest, onDataAvailable , onStopRequest , onChannelRedirect , getInterface , onProgress , onStatus , onRedirect and QueryInterface *Specify a callback function for this listener
(See the other mails for comments on this)
Open channel ------------------ *Open channel specifying a listener I created as parameter ; using the asyncOpen method on the channel object. Create InputStream ---------------------------
The ordering here is not correct. If you want to upload data, you need to set that data before opening the channel.
* of type nsIStringInputStream * add data to the stream using the setData method
(This only works right if all the characters are in the \x01-\xff range)
Create upload channel ------------------------------ * of type nsIUploadChannel * Call setUpload stream method with the created input stream as parameter
You'd call QueryInterface on the previously created channel to get an nsIUploadChannel.
* For making a HTTP connection, I would guess the nsIHttpChannel has to be involved somehow ; but I am not currently using it anywhere in my code . Where would I use it ?
Contrary to what I said in the other mail, there actually is one place where you might need it. See below. Other than that, there's probably no need for it though, unless you want to set additional HTTP headers or something like that.
* The steps outlined so far establish are for sending data ; how do I get back error messages/acknowledgements from the server after POSTing ?
Via the request observer methods. In onStartRequest, you can check whether aRequest.status is a success code (Components.isSuccessCode in JS); if it is, then the server sent back some data. To check whether the HTTP status code is a success code, QueryInterface aRequest to nsIHttpChannel and check the requestSucceeded property.
-christian -- All the world's a stage, And all the men and women merely players: They have their exits and their entrances; And one man in his time plays many parts, [...] --W. Shakespeare _______________________________________________ dev-tech-xpcom mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-xpcom
