當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript comms.Connection類代碼示例

本文整理匯總了TypeScript中@hpcc-js/comms.Connection的典型用法代碼示例。如果您正苦於以下問題:TypeScript Connection類的具體用法?TypeScript Connection怎麽用?TypeScript Connection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Connection類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it("JSONP", function () {
     if (!isTravis() && isBrowser()) {
         const transport = new Connection({ baseUrl: "http://10.241.100.159:800./wsEcl/submit/query/roxie", type: RequestType.JSONP });
         const request = {
             bestfitmax: 1,
             Date1: "19900613",
             Address1: "1740 Maryland Ave",
             City1: "Charlotte",
             State1: "NC",
             Zip1: "28209",
             Zip1LowYYYYMM: "199002",
             Zip1HighYYYYMM: "199101",
             Date2: "19910829",
             Address2: "1512 Turnstone Ct",
             City2: "Rock Hill",
             State2: "SC",
             Zip2: "29732",
             Zip2LowYYYYMM: "199104",
             Zip2HighYYYYMM: "199204",
             Date3: "19990109",
             Address3: "6147 Garamond Ct",
             City3: "Charlotte",
             State3: "NC",
             Zip3: "28270",
             Zip3LowYYYYMM: "199809",
             Zip3HighYYYYMM: "199908",
             GeoDistanceThreshold: "5",
             demomode: true
         };
         return transport.send("wecares.serialoffenderfinderservice/json", request).then((response) => {
             expect(response).exist;
         });
     }
 });
開發者ID:jchambers-ln,項目名稱:Visualization,代碼行數:34,代碼來源:connection.spec.ts

示例2: it

 it("port 8010", function () {
     const transport = new Connection({
         baseUrl: "http://play.hpccsystems.com:8010/",
         userID: "gosmith",
         password: "",
         type: "post"
     });
     return transport.send("WsWorkunits/WUQuery.json", {}).then(function (response) {
         expect(true).to.be.true;
         return response;
     }).catch(function (e) {
         expect(false).to.be.true;
     });
 });
開發者ID:GordonSmith,項目名稱:Visualization,代碼行數:14,代碼來源:connection.spec.ts

示例3: _send

    _send(service, action, _params) {
        var params = lang.mixin({
            request: {},
            load: function (response) {
            },
            error: function (error) {
            },
            event: function (evt) {
            }
        }, _params);
        lang.mixin(params.request, {
            rawxml_: true
        });

        var handleAs = params.handleAs ? params.handleAs : "json";
        var postfix = "";
        if (handleAs === "json") {
            postfix = ".json";
        }
        // var method = params.method ? params.method : "get";

        var retVal = null;
        if (this.isCrossSite()) {
            var transport = new hpccComms.Connection({ baseUrl: this.getBaseURL(service), type: "jsonp" });
            retVal = transport.send(action + postfix, params.request, handleAs === "text" ? "text" : "json");
        } else {
            var transport = new hpccComms.Connection({ baseUrl: this.getBaseURL(service) });
            retVal = transport.send(action + postfix, params.request, handleAs === "text" ? "text" : "json");
        }

        return retVal.then(function (response) {
            if (lang.exists("Exceptions.Exception", response)) {
                if (response.Exceptions.Exception.Code === "401") {
                    if (cookie("Status") === "Unlocked") {
                        topic.publish("hpcc/session_management_status", {
                            status: "DoIdle"
                        });
                    }
                    cookie("Status", "Locked");
                    ESPUtil.LocalStorage.removeItem("Status");
                }
            }
            params.load(response);
            return response;
        }).catch(function (error) {
            params.error(error);
            return error;
        });
    }
開發者ID:AttilaVamos,項目名稱:HPCC-Platform,代碼行數:49,代碼來源:ESPRequest.ts

示例4: _send

    _send(service, action, _params) {
        var params = lang.mixin({
            request: {},
            load: function (response) {
            },
            error: function (error) {
            },
            event: function (evt) {
            }
        }, _params);
        lang.mixin(params.request, {
            rawxml_: true
        });

        var handleAs = params.handleAs ? params.handleAs : "json";
        var postfix = "";
        if (handleAs === "json") {
            postfix = ".json";
        }
        // var method = params.method ? params.method : "get";

        if (this.isLocked()) {
            throw new Error("session locked");
        }

        var retVal = null;
        if (this.isCrossSite()) {
            var transport = new hpccComms.Connection({ baseUrl: this.getBaseURL(service), type: "jsonp" });
            retVal = transport.send(action + postfix, params.request, handleAs === "text" ? "text" : "json");
        } else {
            var transport = new hpccComms.Connection({ baseUrl: this.getBaseURL(service) });
            retVal = transport.send(action + postfix, params.request, handleAs === "text" ? "text" : "json");
        }

        return retVal.then(function (response) {
            params.load(response);
            return response;
        }).catch(function (error) {
            params.error(error);
            return error;
        });
    }
開發者ID:GordonSmith,項目名稱:HPCC-Platform,代碼行數:42,代碼來源:ESPRequest.ts


注:本文中的@hpcc-js/comms.Connection類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。