var Describe = function() { //20180730 } Describe.splitValue = function(str) { if (str) { if (str.length > 0) { return str.split(','); } } return []; } Describe.joinValue = function(o, split) { var s = ','; if (split) { s = '' + split; } if (o) { if (toString.apply(o) === '[object Array]') { return o.join(s); } } return o; } Describe.doPost = function(address, m, data) { $('#url').html(address); if ((m.resultContentType) && m.resultContentType.indexOf('application/json') > -1) { $.ajax({ url : address, type : 'POST', headers : { 'x-debugger' : true }, contentType : (m.contentType.indexOf('application/json') > -1) ? m.contentType : false, processData : (m.contentType.indexOf('application/json') > -1) ? true : false, xhrFields : { 'withCredentials' : true }, data : ((m.contentType.indexOf('application/json') > -1) ? JSON.stringify(data) : data) }).always(function(resultJson) { $('#result').html(JSON.stringify(resultJson, null, 4)); Describe.writeOut(m.outs, resultJson); }); } else { $.ajax({ url : address, type : 'POST', headers : { 'x-debugger' : true }, contentType : (m.contentType.indexOf('application/json') > -1) ? m.contentType : false, processData : (m.contentType.indexOf('application/json') > -1) ? true : false, xhrFields : { 'withCredentials' : true }, data : ((m.contentType.indexOf('application/json') > -1) ? JSON.stringify(data) : data) }); } } Describe.doPut = function(address, m, data) { $('#url').html(address); if ((m.resultContentType) && m.resultContentType.indexOf('application/json') > -1) { $.ajax({ url : address, type : 'PUT', headers : { 'x-debugger' : true }, contentType : (m.contentType.indexOf('application/json') > -1) ? m.contentType : false, processData : (m.contentType.indexOf('application/json') > -1) ? true : false, xhrFields : { 'withCredentials' : true }, data : ((m.contentType.indexOf('application/json') > -1) ? JSON.stringify(data) : data) }).always(function(resultJson) { $('#result').html(JSON.stringify(resultJson, null, 4)); Describe.writeOut(m.outs, resultJson); }); } else { $.ajax({ url : address, type : 'PUT', headers : { 'x-debugger' : true }, contentType : (m.contentType.indexOf('application/json') > -1) ? m.contentType : false, processData : (m.contentType.indexOf('application/json') > -1) ? true : false, xhrFields : { 'withCredentials' : true }, data : ((m.contentType.indexOf('application/json') > -1) ? JSON.stringify(data) : data) }); } } Describe.doGet = function(address, m) { $('#url').html(address); if ((m.resultContentType) && m.resultContentType.indexOf('application/json') > -1) { $.ajax({ type : 'GET', dataType : 'json', url : address, headers : { 'x-debugger' : true }, contentType : m.contentType, xhrFields : { 'withCredentials' : true }, crossDomain : true }).always(function(resultJson) { $('#result').html(JSON.stringify(resultJson, null, 4)); Describe.writeOut(m.outs, resultJson); }); } else { window.open(address, '_blank'); } } Describe.doDelete = function(address, m) { $('#url').html(address); if ((m.resultContentType) && m.resultContentType.indexOf('application/json') > -1) { $.ajax({ type : 'DELETE', dataType : 'json', url : address, headers : { 'x-debugger' : true }, contentType : m.contentType, xhrFields : { 'withCredentials' : true }, crossDomain : true }).always(function(resultJson) { $('#result').html(JSON.stringify(resultJson, null, 4)); Describe.writeOut(m.outs, resultJson); }); } else { $.ajax({ type : 'DELETE', dataType : 'json', url : address, headers : { 'x-debugger' : true }, contentType : m.contentType, xhrFields : { 'withCredentials' : true }, crossDomain : true }); } } Describe.writeOut = function(outs, json) { if (outs && (outs.length) && json && json.data) { $.each(Object.keys(json.data), function(i, k) { $('#out_' + k + '_out', '#outs').html(json.data[k]); }); } } Describe.prototype = { "load" : function() { var str = ''; $("#menu").html(str); $.each(json.jaxrs, function(ji, j) { $.each(j.methods, function(mi, m) { $('#' + j.name + '_' + m.name).click( function() { $('#result').html(''); var txt = '
Method'; txt += ''; txt += ''; txt += ''; txt += ''; txt += ''; txt += '
name:' + m.name + '
path:' + m.path + '
type:' + m.type + '
description:' + m.description + '
'; txt += ''; txt += '
 
'; txt += '
'; if (m.pathParameters && m.pathParameters.length > 0) { txt += '
Path Parameter'; txt += ''; $.each(m.pathParameters, function(pi, p) { if (m.name == 'listNext' || m.name == 'listPrev') { switch (p.name) { case 'flag': case 'id': txt += ''; break; case 'count': txt += ''; break; default: txt += ''; break } } else { txt += ''; } }); txt += '
' + p.name + ':' + p.description + '
' + p.name + ':' + p.description + '
' + p.name + ':' + p.description + '
' + p.name + ':' + p.description + '
'; txt += '
'; } if (m.formParameters && m.formParameters.length > 0) { txt += '
Form Parameter'; txt += ''; $.each(m.formParameters, function(pi, p) { if (p.type == "File") { txt += ''; } else { txt += ''; } }); txt += '
' + p.name + ':' + p.description + '
' + p.name + ':' + p.description + '
'; txt += '
'; } if (m.queryParameters && m.queryParameters.length > 0) { txt += '
Query Parameter'; txt += ''; $.each(m.queryParameters, function(pi, p) { txt += ''; }); txt += '
' + p.name + ':' + p.description + '
'; txt += '
'; } if (m.ins && m.ins.length > 0) { txt += '
In'; txt += ''; $.each(m.ins, function(ii, i) { if (i.isCollection) { txt += '