Closed ikwattro closed 8 years ago
What is good with the framework is that you can just return any objects you want to the Response.
However it would be nice, when you are returning a lot of objects, to be able to stream the response like :
public class test { @RequestMapping(value="/recommendedrepos", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) public ArrayList<HashMap<String, Object>> recommendedRepos(@RequestBody final Request request) { SomeStreamOutput output = new SomeStreamOutput(); //ArrayList<HashMap<String, Object>> res = new ArrayList<>(); HashMap<String, HashMap<String, Object>> results = new HashMap<>(); try (Transaction tx = database.beginTx()) { for (String uid : request.getUids()) { //res.add(recommender.getRepositoriesForOrganizationByUid(uid)); output.write(recommender.getRepositoriesForOrganizationByUid(uid)); } tx.success(); } return res; } }
have a look at https://github.com/graphaware/neo4j-framework/tree/master/examples/node-streaming
What is good with the framework is that you can just return any objects you want to the Response.
However it would be nice, when you are returning a lot of objects, to be able to stream the response like :