Refactoring data-tables-invoker-api

revert-70aa11f8
dilanua 8 years ago
parent 225b1ddc45
commit 8f81f2bb01

@ -25,24 +25,21 @@ var uriMatcher = new URIMatcher(String(uri));
var devicemgtProps = require("/app/conf/devicemgt-props.js").config();
var serviceInvokers = require("/app/modules/backend-service-invoker.js")["backendServiceInvoker"];
if (uriMatcher.match("/{context}/api/data-tables/invoker")) {
var url = request.getParameter("url");
var targetURL;
var payload = request.getContent();
function appendQueryParam (url, queryParam , value) {
if (url.indexOf("?") > 0) {
return url + "&" + queryParam + "=" + value;
}
return url + "?" + queryParam + "=" + value;
function appendQueryParam (url, queryParam , value) {
if (url.indexOf("?") > 0) {
return url + "&" + queryParam + "=" + value;
}
targetURL = devicemgtProps["httpsURL"] + request.getParameter("url");
return url + "?" + queryParam + "=" + value;
}
if (uriMatcher.match("/{context}/api/data-tables/invoker")) {
var url = request.getParameter("url");
var targetURL = devicemgtProps["httpsURL"] + request.getParameter("url");
var allParams = request.getAllParameters();
for (var key in allParams) {
if (allParams.hasOwnProperty(key)) {
if(key == "limit" || key == "offset" || key == "filter"){
if (key == "limit" || key == "offset" || key == "filter") {
targetURL = appendQueryParam(targetURL, key, allParams[key]);
}
}

Loading…
Cancel
Save