java - JSON response Issue for Jira Rest Client -
when use following method :
public string getprojectlist() { projnames = new arraylist<>(); projnames.add("project1"); projnames.add("project2"); projnames.add("project3"); return new gson().tojson(projnames);
in following code :
$(document).ready(function() { $.getjson('dbdropdown', function(resp) { // on sucess var $select = $('#someselect'); $select.find('option').remove(); $select.prepend("<option value='select project'></option>").val(''); $.each(resp, function(key, value) { // iterate on json object. $('<option>').val(key).text(value).appendto($select); // create html <option> element, set value iterated key , text content iterated item , append <select>. }); }).fail(function() { // on failure alert("request failed."); }); });
and jsp call :
response.getwriter().write(musicdatabase .getinstance() .getprojectlist()
i able dropdown menu. when use method in place of getprojectlist dont response when check chrome developer tools , debug.
public string names() throws urisyntaxexception{ names = new arraylist<>(); uri uri = new uri("https://jira.xxxxx.com"); jirarestclientfactory jrcf = new asynchronousjirarestclientfactory(); jirarestclient jrc = jrcf.createwithbasichttpauthentication(uri, "xxx", "xxxx"); iterable<basicproject> allproject = jrc.getprojectclient().getallprojects().claim(); for(basicproject project : allproject){ names.add(project.getname()); } return new gson().tojson(names); }
i not getting response , console throws classdefnotfound exception when have classes needed. me if have gone through type of issue.
thanks
Comments
Post a Comment