⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 microsoftajaxadonet.debug.js

📁 ajax
💻 JS
📖 第 1 页 / 共 5 页
字号:
            if (uri) {
                webRequest.set_url(uri);
            }
        }
        onSuccess = onSuccess || this.get_defaultSucceededCallback();
        onFailure = onFailure || this.get_defaultFailedCallback();
        if ((typeof(context) === "undefined") || (context === null)) {
            context = this.get_defaultUserContext();
        }
        webRequest.add_completed(Function.createDelegate(this, function(executor) {
            this._onResponseComplete(executor, onSuccess, onFailure, context, operation);
        }));
        return webRequest;
    }
Sys.Data.AdoNetServiceProxy.prototype = {
    _replaceOnUpdate: false,
    _serviceUri: null,
    _usePostTunneling: true,
    get_path: Sys$Data$AdoNetServiceProxy$get_path,
    set_path: Sys$Data$AdoNetServiceProxy$set_path,
    get_replaceOnUpdate: Sys$Data$AdoNetServiceProxy$get_replaceOnUpdate,
    set_replaceOnUpdate: Sys$Data$AdoNetServiceProxy$set_replaceOnUpdate,
    get_serviceUri: Sys$Data$AdoNetServiceProxy$get_serviceUri,
    createActionSequence: Sys$Data$AdoNetServiceProxy$createActionSequence,
    insert: Sys$Data$AdoNetServiceProxy$insert,
    invoke: Sys$Data$AdoNetServiceProxy$invoke,
    fetchData: Sys$Data$AdoNetServiceProxy$fetchData,
    fetchDeferredProperty: Sys$Data$AdoNetServiceProxy$fetchDeferredProperty,
    query: Sys$Data$AdoNetServiceProxy$query,
    update: Sys$Data$AdoNetServiceProxy$update,
    remove: Sys$Data$AdoNetServiceProxy$remove,
    _checkForError: Sys$Data$AdoNetServiceProxy$_checkForError,
    _onResponseComplete: Sys$Data$AdoNetServiceProxy$_onResponseComplete,
    _prepareWebRequest: Sys$Data$AdoNetServiceProxy$_prepareWebRequest
}
Sys.Data.AdoNetServiceProxy._createFailedError = function Sys$Data$AdoNetServiceProxy$_createFailedError(operation, errorMessage) {
    var displayMessage = "Sys.Data.AdoNetException: " + errorMessage;
    var e = Error.create(displayMessage, { name: "Sys.Data.AdoNetException", operation: operation });
    e.popStackFrame();
    return e;
}
Sys.Data.AdoNetServiceProxy.registerClass("Sys.Data.AdoNetServiceProxy", Sys.Net.WebServiceProxy, Sys.Data.IDataProvider);
Sys.Data._AdoNetBatchReader = function Sys$Data$_AdoNetBatchReader(responseBody, boundary) {
    if (!responseBody) throw "Argument 'responseBody' missing";
    if (!boundary) throw "Argument 'boundary' missing";
    this._responseBody = responseBody;
    this._boundary = [boundary];
    this._position = 0;
    this._responses = [];
    this._parseParts(this._responses);
}
    function Sys$Data$_AdoNetBatchReader$get_responses() {
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._responses;
    }
    function Sys$Data$_AdoNetBatchReader$_parseParts(responses) {
        if (this._readToMark("--" + this._currentBoundary(), true) === null) return;
        this._readLine();
        var endmark = null;
        while ((endmark !== "--") && !this._eof()) {
            var partHeaders = [];
            this._parseHeaders(partHeaders);
            var partType = partHeaders["Content-Type"];
            if (!partType) throw "Invalid MIME part, no content-type header";
            if (partType.indexOf("multipart/mixed") === 0) {
                var nested = [];
                this._boundary.push(Sys.Data._AdoNetBatchReader._boundaryFromTypeHeader(partType));
                this._parseParts(nested);
                this._boundary.pop();
                responses.push(nested);
                var check = this._readToMark("--" + this._currentBoundary(), true);
                if (check === null) throw "Invalid multi-part document, cannot find closing boundary";
            }
            else if (partType.indexOf("application/http") === 0) {
                responses.push(this._parseHttpResponse());
            }
            else {
                throw "Invalid MIME part type '" + partType + "'";
            }
            endmark = this._peek(2);
            this._readLine();
        }
    }
    function Sys$Data$_AdoNetBatchReader$_parseHttpResponse() {
        var line = this._readLine(),
            status = this._parseStatus(line);
        if (status === null) throw "Invalid HTTP status line '" + line + "'";
        var headers = [];
        this._parseHeaders(headers);
        var body = this._readToMark("--" + this._currentBoundary(), true);
        if (body === null) throw "Invalid multipart document, cannot find closing/next boundary";
        if (body === "\r\n") body = "";
        return { status: status, headers: headers, body: body };
    }
    function Sys$Data$_AdoNetBatchReader$_parseHeaders(target) {
        for (var line = this._readLine(); line; line = this._readLine()) {
            var h = this._parseHeader(line);
            if (h === null) throw "Expected header with format name : value";
            target[h.name] = h.value;
        }
    }
    function Sys$Data$_AdoNetBatchReader$_parseHeader(s) {
        if (s === null) return null;
        var index = s.indexOf(":");
        return (index === -1) ? null :
            { name: s.substring(0, index).trim(), value: s.substring(index + 1).trim() };
    }
    function Sys$Data$_AdoNetBatchReader$_parseStatus(s) {
        var match = Sys.Data._AdoNetBatchReader._statusRegExp.exec(s);
        return match ? ({ code: match[1], text: match[2] }) : null;
    }
    function Sys$Data$_AdoNetBatchReader$_currentBoundary() {
        return this._boundary[this._boundary.length - 1];
    }
    function Sys$Data$_AdoNetBatchReader$_eof() {
        return this._position === -1;
    }
    function Sys$Data$_AdoNetBatchReader$_readLine() {
        return this._readToMark("\r\n", false);
    }
    function Sys$Data$_AdoNetBatchReader$_readToMark(mark, nullIfMissing) {
        if (this._eof()) return null; 
        var r, index = this._responseBody.indexOf(mark, this._position);
        if (index < 0) {
            if (nullIfMissing) {
                r = null;
            }
            else {
                r = this._responseBody.substring(this._position);
                this._position = -1;
            }
        }
        else {
            r = this._responseBody.substring(this._position, index);
            this._position = index + mark.length;
        }
        return r;
    }
    function Sys$Data$_AdoNetBatchReader$_peek(len) {
        if (!len) throw "Argument 'len' missing";
        if (this._eof()) return "";
        return this._responseBody.substring(this._position, this._position + len);
    }
Sys.Data._AdoNetBatchReader.prototype = {
    get_responses: Sys$Data$_AdoNetBatchReader$get_responses,
    _parseParts: Sys$Data$_AdoNetBatchReader$_parseParts,
    _parseHttpResponse: Sys$Data$_AdoNetBatchReader$_parseHttpResponse,
    _parseHeaders: Sys$Data$_AdoNetBatchReader$_parseHeaders,
    _parseHeader: Sys$Data$_AdoNetBatchReader$_parseHeader,
    _parseStatus: Sys$Data$_AdoNetBatchReader$_parseStatus,
    _currentBoundary: Sys$Data$_AdoNetBatchReader$_currentBoundary,
    _eof: Sys$Data$_AdoNetBatchReader$_eof,
    _readLine: Sys$Data$_AdoNetBatchReader$_readLine,
    _readToMark: Sys$Data$_AdoNetBatchReader$_readToMark,
    _peek: Sys$Data$_AdoNetBatchReader$_peek
}
Sys.Data._AdoNetBatchReader._boundaryFromTypeHeader = function Sys$Data$_AdoNetBatchReader$_boundaryFromTypeHeader(header) {
    if (!header) throw "Argument 'header' missing";
    var re = /;\s*boundary=(.*)$/i,
        match = re.exec(header);
    return match ? match[1] : null;
};
Sys.Data._AdoNetBatchReader._parseResponse = function Sys$Data$_AdoNetBatchReader$_parseResponse(executor) {
    var r = new Sys.Data._AdoNetBatchReader(executor.get_responseData(), Sys.Data._AdoNetBatchReader._boundaryFromTypeHeader(executor.getResponseHeader("Content-Type")));
    return r.get_responses();
};
Sys.Data._AdoNetBatchReader._statusRegExp = new RegExp("^HTTP\\/1\\.[01] (\\d{3}) (.*)$", "i");
Sys.Data._AdoNetBatchReader.registerClass("Sys.Data._AdoNetBatchReader");
Sys.Data._AdoNetBatchWriter = function Sys$Data$_AdoNetBatchWriter(host) {
    this._host = host;
    this._content = "";
    this._boundary = null;
    this._changesetBoundary = null;
    this._changesetEntries = null;
    this._contentType = "application/json";
}
    function Sys$Data$_AdoNetBatchWriter$get_contentType() {
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._contentType;
    }
    function Sys$Data$_AdoNetBatchWriter$set_contentType(type) {
        var re = /;\s*charset\s*=/i,
            match = re.exec(type);
        if (match) throw "MIME type cannot include 'charset' parameter";
        this._contentType = type;
    }
    function Sys$Data$_AdoNetBatchWriter$get_requestBody() {
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._content + "--" + this.get_topBoundary() + "--";
    }
    function Sys$Data$_AdoNetBatchWriter$get_topBoundary() {
        if (arguments.length !== 0) throw Error.parameterCount();
        if (!this._boundary) {
            this._boundary = "batch_" + this._createBoundary();
        }
        return this._boundary;
    }
    function Sys$Data$_AdoNetBatchWriter$addChange(targetUri, eTag, method, body, contentId) {
        if (!targetUri) throw "Argument 'targetUri' missing";
        if (!method) throw "Argument 'method' missing";
        if (!this._changesetBoundary) throw "There is no active changeset";
        this._changesetEntries.push({ uri: targetUri, eTag: eTag, method: method, body: body, contentId: contentId });
    }
    function Sys$Data$_AdoNetBatchWriter$addQuery(queryUri) {
        if (!queryUri) throw "Argument 'queryUri' missing";
        this._content += this._startPart(this.get_topBoundary(), "GET", queryUri, null) + "\r\n";
    }
    function Sys$Data$_AdoNetBatchWriter$endChangeSet() {
        if (!this._changesetBoundary) throw "There is no active changeset";
        var changeset = "";
        for (var key in this._changesetEntries) {
            var entry = this._changesetEntries[key];
            changeset += this._startPart(this._changesetBoundary, entry.method, entry.uri, entry.eTag, entry.contentId);
            if (entry.body) {
                changeset += "Content-Type: " + this._contentType + ";charset=utf-8\r\n";
            }
            changeset += "\r\n";
            if (entry.body) {
                changeset += entry.body;
            }
        }
        if (changeset) {
            changeset += "\r\n--" + this._changesetBoundary + "--\r\n";
        }
        this._content += "\r\n--" + this.get_topBoundary() + "\r\nContent-Type: multipart/mixed;boundary=" +
                         this._changesetBoundary + "\r\n\r\n" + changeset;
        this._changesetBoundary = null;
        this._changesetEntries = null;
    }
    function Sys$Data$_AdoNetBatchWriter$startChangeSet() {
        if (this._changesetBoundary) throw "There is an active changeset already";
        this._changesetBoundary = "changeset_" + this._createBoundary();
        this._changesetEntries = [];
    }
    function Sys$Data$_AdoNetBatchWriter$_createBoundary() {
        function hex16() {
            return Math.floor((1 + Math.random()) * 0x10000).toString(16).substr(1);
        }
        return hex16() + "-" + hex16() + "-" + hex16();
    }
    function Sys$Data$_AdoNetBatchWriter$_startPart(boundary, method, uri, eTag, contentId) {
        var start = "\r\n--" + boundary + "\r\nContent-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\n" + method + " " + uri + " HTTP/1.1\r\n";
        if (typeof(contentId) === "number") {
            start += "Content-ID: " + contentId + "\r\n";
        }
        if (eTag) {
            start += "If-Match: " + eTag + "\r\n";
        }
        start += "Host: " + this._host + "\r\nAccept: " + this.get_contentType() + "\r\nAccept-Charset: utf-8\r\n";
        return start;
    }
Sys.Data._AdoNetBatchWriter.prototype = {
    get_contentType: Sys$Data$_AdoNetBatchWriter$get_contentType,
    set_contentType: Sys$Data$_AdoNetBatchWriter$set_contentType,
    get_requestBody: Sys$Data$_AdoNetBatchWriter$get_requestBody,
    get_topBoundary: Sys$Data$_AdoNetBatchWriter$get_topBoundary,
    addChange: Sys$Data$_AdoNetBatchWriter$addChan

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -