Skip to content

Commit

Permalink
refactored jsDAV to support parallel requests! (which is common in No…
Browse files Browse the repository at this point in the history
…deJS)
  • Loading branch information
mikedeboer committed Sep 17, 2010
1 parent 2a0e874 commit 05ec218
Show file tree
Hide file tree
Showing 12 changed files with 2,094 additions and 2,085 deletions.
30 changes: 15 additions & 15 deletions lib/DAV/exceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,24 @@ exports.jsDAV_Exception = function(msg, extra) {
*
* @return array
*/
this.getHTTPHeaders = function(server, cbheaders) { cbheaders(null, {}); };
this.getHTTPHeaders = function(handler, cbheaders) { cbheaders(null, {}); };

/**
* This method allows the exception to include additonal information into the
* WebDAV error response
*
* @param Sabre_DAV_Server $server
* @param DOMElement $errorNode
* @param {jsDAV_Handler} handler
* @param {DOMElement} errorNode
* @return void
*/
this.serialize = function(server, errorNode) {return errorNode;};
this.serialize = function(handler, errorNode) {return errorNode;};

this.toString = function(server, cbtostring) {
this.toString = function(handler, cbtostring) {
var _self = this,
headers = "";
if (server) {
if (handler) {
headers = "Headers: ";
this.getHTTPHeaders(server, function(err, h) {
this.getHTTPHeaders(handler, function(err, h) {
for (var i in h) {
headers += "\t" + i + ": " + h[i] + "\n";
}
Expand Down Expand Up @@ -117,7 +117,7 @@ exports.jsDAV_Exception_Locked = function(lock) {
this.type = this.message = "jsDAV_Exception_Locked";
this.lock = lock;

this.serialize = function(server, errorNode) {
this.serialize = function(handler, errorNode) {
if (this.lock) {
return errorNode + "<d:lock-token-submitted><d:href>" + this.lock.uri
+ "</d:href></d:lock-token-submitted>";
Expand All @@ -137,7 +137,7 @@ exports.jsDAV_Exception_ConflictingLock = function(lock) {
this.type = message = "jsDAV_Exception_ConflictingLock";
this.lock = lock;

this.serialize = function(server, errorNode) {
this.serialize = function(handler, errorNode) {
if (this.lock) {
return errorNode + "<d:no-conflicting-lock><d:href>" + this.lock.uri
+ "</d:href></d:no-conflicting-lock>";
Expand Down Expand Up @@ -198,7 +198,7 @@ exports.jsDAV_Exception_InvalidResourceType = function(msg, extra) {
this.type = "jsDAV_Exception_InvalidResourceType";
this.message = msg || this.type;

this.serialize = function(server, errorNode) {
this.serialize = function(handler, errorNode) {
return errorNode + "<d:valid-resourcetype />";
};
};
Expand All @@ -213,7 +213,7 @@ exports.jsDAV_Exception_LockTokenMatchesRequestUri = function() {
this.type = "jsDAV_Exception_LockTokenMatchesRequestUri";
this.message = "The locktoken supplied does not match any locks on this entity";

this.serialize = function(server, errorNode) {
this.serialize = function(handler, errorNode) {
return errorNode + "<d:lock-token-matches-request-uri />";
};
};
Expand All @@ -229,8 +229,8 @@ exports.jsDAV_Exception_MethodNotAllowed = function(msg, extra) {
this.type = "jsDAV_Exception_MethodNotAllowed";
this.message = msg || this.type;

this.getHTTPHeaders = function(server, cbmethods) {
server.getAllowedMethods(server.getRequestUri(), function(err, methods) {
this.getHTTPHeaders = function(handler, cbmethods) {
handler.getAllowedMethods(handler.getRequestUri(), function(err, methods) {
cbmethods(err, {
"Allow" : methods.join(", ").toUpperCase()
});
Expand Down Expand Up @@ -278,7 +278,7 @@ exports.jsDAV_Exception_PreconditionFailed = function(msg, extra) {
this.message = msg || this.type;
this.header = extra;

this.serialize = function(server, errorNode) {
this.serialize = function(handler, errorNode) {
return this.header
? errorNode + "<a:header>" + this.header + "</a:header>"
: errorNode;
Expand All @@ -296,7 +296,7 @@ exports.jsDAV_Exception_ReportNotImplemented = function(msg, extra) {
this.type = "jsDAV_Exception_ReportNotImplemented";
this.message = msg || this.type;

this.serialize = function(server, errorNode) {
this.serialize = function(handler, errorNode) {
return errorNode + "<d:supported-report/>";
};
};
Expand Down
Loading

0 comments on commit 05ec218

Please sign in to comment.