|
|
@ -33,7 +33,9 @@ var result;
|
|
|
|
|
|
|
|
|
|
|
|
if (uriMatcher.match("/{context}/api/device/sketch/")) {
|
|
|
|
if (uriMatcher.match("/{context}/api/device/sketch/")) {
|
|
|
|
sketchType = request.getParameter("type");
|
|
|
|
sketchType = request.getParameter("type");
|
|
|
|
if(!sketchType){log.error("Sketch Type is empty");}
|
|
|
|
if (!sketchType) {
|
|
|
|
|
|
|
|
log.error("Sketch Type is empty");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var user = session.get(constants.USER_SESSION_KEY);
|
|
|
|
var user = session.get(constants.USER_SESSION_KEY);
|
|
|
|
if (!user) {
|
|
|
|
if (!user) {
|
|
|
@ -41,9 +43,10 @@ if (uriMatcher.match("/{context}/api/device/sketch/")) {
|
|
|
|
exit();
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//URL: /iotdevices/FireAlarmManager/device/firealarm/download
|
|
|
|
fireAlarmManagerService = carbonHttpsServletTransport + "/iotdevices/FireAlarmManager";
|
|
|
|
fireAlarmManagerService = carbonHttpsServletTransport + "/iotdevices/FireAlarmManager";
|
|
|
|
sketchDownloadEndPoint = fireAlarmManagerService + "/downloadSketch";
|
|
|
|
sketchDownloadEndPoint = fireAlarmManagerService + "/device/" + sketchType + "/download";
|
|
|
|
response.sendRedirect(sketchDownloadEndPoint + "?type="+sketchType+"&owner="+user.username);
|
|
|
|
response.sendRedirect(sketchDownloadEndPoint + "?owner=" + user.username);
|
|
|
|
exit();
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -57,12 +60,13 @@ if (uriMatcher.match("/{context}/api/devices/")) {
|
|
|
|
exit();
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//URL: /iotdevices/DevicesManager/devices/username
|
|
|
|
devicesManagerService = carbonHttpsServletTransport + "/iotdevices/DevicesManager";
|
|
|
|
devicesManagerService = carbonHttpsServletTransport + "/iotdevices/DevicesManager";
|
|
|
|
listAllDevicesEndPoint = devicesManagerService + "/getDevices";
|
|
|
|
listAllDevicesEndPoint = devicesManagerService + "/devices/" + user.username;
|
|
|
|
|
|
|
|
|
|
|
|
var data = {};
|
|
|
|
var data = {};
|
|
|
|
//XMLHTTPRequest's GET
|
|
|
|
//XMLHTTPRequest's GET
|
|
|
|
result = get(listAllDevicesEndPoint+"?username="+user.username, data ,"json");
|
|
|
|
result = get(listAllDevicesEndPoint, data, "json");
|
|
|
|
|
|
|
|
|
|
|
|
//response.sendRedirect(listAllDevicesEndPoint + "?username="+user.username);
|
|
|
|
//response.sendRedirect(listAllDevicesEndPoint + "?username="+user.username);
|
|
|
|
//exit();
|
|
|
|
//exit();
|
|
|
|