|
|
@ -73,11 +73,26 @@ var invokers = function () {
|
|
|
|
var xmlHttpRequest = new XMLHttpRequest();
|
|
|
|
var xmlHttpRequest = new XMLHttpRequest();
|
|
|
|
|
|
|
|
|
|
|
|
xmlHttpRequest.open(httpMethod, endpoint);
|
|
|
|
xmlHttpRequest.open(httpMethod, endpoint);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var contentTypeFound = false;
|
|
|
|
|
|
|
|
var acceptTypeFound = false;
|
|
|
|
for (var i in headers) {
|
|
|
|
for (var i in headers) {
|
|
|
|
xmlHttpRequest.setRequestHeader(headers[i].name, headers[i].value);
|
|
|
|
xmlHttpRequest.setRequestHeader(headers[i].name, headers[i].value);
|
|
|
|
|
|
|
|
if(constants["CONTENT_TYPE_IDENTIFIER"] == headers[i].name){
|
|
|
|
|
|
|
|
contentTypeFound = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(constants["ACCEPT_IDENTIFIER"] == headers[i].name){
|
|
|
|
|
|
|
|
acceptTypeFound = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!contentTypeFound) {
|
|
|
|
|
|
|
|
xmlHttpRequest.setRequestHeader(constants["CONTENT_TYPE_IDENTIFIER"], constants["APPLICATION_JSON"]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!acceptTypeFound) {
|
|
|
|
|
|
|
|
xmlHttpRequest.setRequestHeader(constants["ACCEPT_IDENTIFIER"], constants["APPLICATION_JSON"]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xmlHttpRequest.setRequestHeader(constants["CONTENT_TYPE_IDENTIFIER"], constants["APPLICATION_JSON"]);
|
|
|
|
|
|
|
|
xmlHttpRequest.setRequestHeader(constants["ACCEPT_IDENTIFIER"], constants["APPLICATION_JSON"]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (devicemgtProps["isOAuthEnabled"]) {
|
|
|
|
if (devicemgtProps["isOAuthEnabled"]) {
|
|
|
|
var accessToken = privateMethods.getAccessToken();
|
|
|
|
var accessToken = privateMethods.getAccessToken();
|
|
|
@ -284,23 +299,37 @@ var invokers = function () {
|
|
|
|
|
|
|
|
|
|
|
|
//noinspection JSUnresolvedVariable
|
|
|
|
//noinspection JSUnresolvedVariable
|
|
|
|
var Header = Packages.org.apache.commons.httpclient.Header;
|
|
|
|
var Header = Packages.org.apache.commons.httpclient.Header;
|
|
|
|
|
|
|
|
var contentTypeFound = false;
|
|
|
|
|
|
|
|
var acceptTypeFound = false;
|
|
|
|
for (var i in headers) {
|
|
|
|
for (var i in headers) {
|
|
|
|
var header = new Header();
|
|
|
|
var header = new Header();
|
|
|
|
header.setName(headers[i].name);
|
|
|
|
header.setName(headers[i].name);
|
|
|
|
header.setValue(headers[i].value);
|
|
|
|
header.setValue(headers[i].value);
|
|
|
|
httpMethodObject.addRequestHeader(header);
|
|
|
|
httpMethodObject.addRequestHeader(header);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(constants["CONTENT_TYPE_IDENTIFIER"] == headers[i].name){
|
|
|
|
|
|
|
|
contentTypeFound = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(constants["ACCEPT_IDENTIFIER"] == headers[i].name){
|
|
|
|
|
|
|
|
acceptTypeFound = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var header = new Header();
|
|
|
|
var header = new Header();
|
|
|
|
header.setName(constants["CONTENT_TYPE_IDENTIFIER"]);
|
|
|
|
if(!contentTypeFound){
|
|
|
|
header.setValue(constants["APPLICATION_JSON"]);
|
|
|
|
header.setName(constants["CONTENT_TYPE_IDENTIFIER"]);
|
|
|
|
//noinspection JSUnresolvedFunction
|
|
|
|
header.setValue(constants["APPLICATION_JSON"]);
|
|
|
|
httpMethodObject.addRequestHeader(header);
|
|
|
|
//noinspection JSUnresolvedFunction
|
|
|
|
header = new Header();
|
|
|
|
httpMethodObject.addRequestHeader(header);
|
|
|
|
header.setName(constants["ACCEPT_IDENTIFIER"]);
|
|
|
|
}
|
|
|
|
header.setValue(constants["APPLICATION_JSON"]);
|
|
|
|
|
|
|
|
//noinspection JSUnresolvedFunction
|
|
|
|
if(!acceptTypeFound) {
|
|
|
|
httpMethodObject.addRequestHeader(header);
|
|
|
|
header = new Header();
|
|
|
|
|
|
|
|
header.setName(constants["ACCEPT_IDENTIFIER"]);
|
|
|
|
|
|
|
|
header.setValue(constants["APPLICATION_JSON"]);
|
|
|
|
|
|
|
|
//noinspection JSUnresolvedFunction
|
|
|
|
|
|
|
|
httpMethodObject.addRequestHeader(header);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (devicemgtProps["isOAuthEnabled"]) {
|
|
|
|
if (devicemgtProps["isOAuthEnabled"]) {
|
|
|
|
var accessToken = privateMethods.getAccessToken();
|
|
|
|
var accessToken = privateMethods.getAccessToken();
|
|
|
|