Skip to content

Commit

Permalink
updated the associated object that is returned on a GET request to a …
Browse files Browse the repository at this point in the history
…stream node
  • Loading branch information
jortizcs committed Jan 16, 2012
1 parent f50da26 commit a58d782
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/local/rest/resources/GenericPublisherResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ public synchronized void get(HttpExchange exchange, boolean internalCall, JSONOb
if(properties == null){
properties = new JSONObject();
}
properties.put("type", "properties");
//properties.put("type", "properties");
response.put("status", "success");

UUID assocPubid = database.isRRPublisher2(this.URI);
if(assocPubid != null){
response.put("pubid", assocPubid.toString());
logger.info("POPULATING");
properties.put("PubId", assocPubid.toString());
properties.put("URI", this.URI);
String dataStr = "URI: " + this.URI + "\n\nPubId: " + assocPubid.toString();
properties.put("data", dataStr);
//properties.put("PubId", assocPubid.toString());
//properties.put("URI", this.URI);
//String dataStr = "URI: " + this.URI + "\n\nPubId: " + assocPubid.toString();
//properties.put("data", dataStr);

//get last few values received
//db.is4_main_coll.find().sort({timestamp:1}).limit(5);
Expand All @@ -113,7 +113,12 @@ public synchronized void get(HttpExchange exchange, boolean internalCall, JSONOb
queryJSON.toString(),
sortByJSON.toString(),
headCount);
properties.put("head", lastValuesReceived.toString());
JSONArray res = lastValuesReceived.optJSONArray("results");
if(res!=null && res.size()>0)
lastValuesReceived = (JSONObject) res.get(0);
else
lastValuesReceived = new JSONObject();
response.put("head", lastValuesReceived.toString());
}
response.put("properties", properties);
sendResponse(exchange, 200, response.toString(), internalCall, internalResp);
Expand Down

0 comments on commit a58d782

Please sign in to comment.