本文整理汇总了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;
});
}
});
示例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;
});
});
示例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;
});
}
示例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;
});
}