|
|
@ -48,27 +48,28 @@ if (!user) {
|
|
|
|
var deviceType = request.getParameter("deviceType"); // need a better solution here
|
|
|
|
var deviceType = request.getParameter("deviceType"); // need a better solution here
|
|
|
|
deviceTypeConfig = utility.getDeviceTypeConfig(deviceType);
|
|
|
|
deviceTypeConfig = utility.getDeviceTypeConfig(deviceType);
|
|
|
|
if (deviceTypeConfig && deviceTypeConfig.deviceType.downloadAgentUri) {
|
|
|
|
if (deviceTypeConfig && deviceTypeConfig.deviceType.downloadAgentUri) {
|
|
|
|
|
|
|
|
hearders = [{"name": constants["ACCEPT_IDENTIFIER"], "value": constants["APPLICATION_ZIP"]}];
|
|
|
|
sketchDownloadEndPoint = devicemgtProps["httpsURL"] + "/" + deviceTypeConfig.deviceType.downloadAgentUri;
|
|
|
|
sketchDownloadEndPoint = devicemgtProps["httpsURL"] + "/" + deviceTypeConfig.deviceType.downloadAgentUri;
|
|
|
|
serviceInvokers.HttpClient.get(sketchDownloadEndPoint + queryString, function (responsePayload, responseHeaders) {
|
|
|
|
serviceInvokers.HttpClient.get(sketchDownloadEndPoint + queryString, function (responsePayload, responseHeaders) {
|
|
|
|
if (responseHeaders) {
|
|
|
|
if (responseHeaders) {
|
|
|
|
for (var i = 0; i < responseHeaders.length; i++) {
|
|
|
|
for (var i = 0; i < responseHeaders.length; i++) {
|
|
|
|
var header = responseHeaders[i]
|
|
|
|
var header = responseHeaders[i];
|
|
|
|
var headerName = String(header.getName());
|
|
|
|
var headerName = String(header.getName());
|
|
|
|
var headerValue = String(header.getValue());
|
|
|
|
var headerValue = String(header.getValue());
|
|
|
|
response.addHeader(headerName, headerValue);
|
|
|
|
response.addHeader(headerName, headerValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var streamObject = new Stream(responsePayload);
|
|
|
|
var streamObject = new Stream(responsePayload);
|
|
|
|
print(streamObject);
|
|
|
|
print(streamObject);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return responsePayload;
|
|
|
|
return responsePayload;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, function (responsePayload) {
|
|
|
|
}, function (responsePayload) {
|
|
|
|
log.error(responsePayload)
|
|
|
|
log.error(responsePayload);
|
|
|
|
var response = {};
|
|
|
|
var response = {};
|
|
|
|
response["status"] = "error";
|
|
|
|
response["status"] = "error";
|
|
|
|
return response;
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
, hearders);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
result = 400;
|
|
|
|
result = 400;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -143,14 +144,14 @@ if (!user) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
serviceInvokers.XMLHttp.get(
|
|
|
|
serviceInvokers.XMLHttp.get(
|
|
|
|
targetURL, function (responsePayload) {
|
|
|
|
targetURL, function (responsePayload) {
|
|
|
|
response.status = 200;
|
|
|
|
response.status = 200;
|
|
|
|
result = responsePayload;
|
|
|
|
result = responsePayload;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
function (responsePayload) {
|
|
|
|
function (responsePayload) {
|
|
|
|
response.status = responsePayload.status;
|
|
|
|
response.status = responsePayload.status;
|
|
|
|
result = responsePayload.responseText;
|
|
|
|
result = responsePayload.responseText;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else if (uriMatcher.match("/{context}/api/devices/")) {
|
|
|
|
} else if (uriMatcher.match("/{context}/api/devices/")) {
|
|
|
|
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/list")) {
|
|
|
|
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/list")) {
|
|
|
|
result = deviceModule.listDevices();
|
|
|
|
result = deviceModule.listDevices();
|
|
|
|