Dan Lee wrote:

Does anyone know of a way to get the timestamp for a remote file?

For webdav you do a PROPFIND via nsIXMLHttpRequest and look at(parse) the response xml for the getlastmodified node. Here's a code fragment:

xmlRequestInterface.open("PROPFIND", uri, false, "", "");
xmlRequestInterface.setRequestHeader("Depth", tempDepth);
xmlRequestInterface.setRequestHeader("Content-type", "text/xml");
xmlRequestInterface.send("");
} catch (e) {
alert ("Failed because : " + e);
}
var responseText = xmlRequestInterface.responseText;

Jim

For our project ReminderFox we have code to download/upload a calendar
file via FTP or WebDAV.  We would like to do this automatically and be
smart about it -- that is, only have to download the remote calendar
file if it actually differs from the file on the local system. I thought
the best way would be to check the timestamp of the remote file, but I
am not sure how this can be done.
For downloading the file, I was utilizing code of this sort:

var ioService  =
Components.classes["@ mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService) <http://mozilla.org/network/io-service;1%22%5D.getService%28Components.interfaces.nsIIOService%29>;
this.streamLoader=Components
.classes["@ mozilla.org/network/stream-loader;1"].createInstance(Components.interfaces.nsIStreamLoader) <http://mozilla.org/network/stream-loader;1%22%5D.createInstance%28Components.interfaces.nsIStreamLoader%29>;
this._channel = ioService.newChannelFromURI( aURI );
if(aURI.scheme=="http" || aURI.scheme=="https")
 this._channel.loadFlags |=
Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE;
 this.streamLoader.init(this._channel, this , null);

Since it's just dealing with streams, I am not sure if there's any way
to get the timestamp of the file that the stream was created from.  Has
anyone done anything similar or having any ideas of how I could do this?

Thanks.

------------------------------------------------------------------------

_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners

Reply via email to