I am writing a Rest service that checks to see if any providers are ingesting. If so return true and if not return false. I wouldn't mind if it returned a boolean but I couldn't find anything about it when doing research. This is the javascript that calls the rest service in a ajax call:
var result = $.ajax({url:cdpeConfig.providerUrl+'/updateStatus',type: 'GET'});
if (result=="true"){
alert(result);
}
else{
alert(JSON.stringify(result));
}
the json.stringify is the only way I have been able to see what it returns. All I have seen it return is {"readyState":1} Here is the java:
`@GET
@Path("/updateStatus")
@Produces({MediaType.TEXT_PLAIN})
public String isIngesting(){
String result = "false";
List<Provider> providers = new ArrayList<Provider>();
providers = providerManager.getAllProviders();
for (Provider provider : providers) {
if (provider.getUpdateStatus().toLowerCase().equals(CdpeEnum.UpdateStatus.INGEST.toString().toLowerCase()) ) {
result = "true";
}
}
return result;
}`
Aucun commentaire:
Enregistrer un commentaire