Preparing the result of an HTTP call may lead to storing a lot of objects on the server side and thus triggering more garbage collection by the JVM than needed. To keep a lower memory footprint, there is the possibility of streaming the results.
We will get the list of friend's names of someone whose name is given as a parameter.
Create a new class with this code:
package learningneo4j;import org.codehaus.jackson.JsonEncoding;import org.codehaus.jackson.JsonGenerator;import org.codehaus.jackson.map.ObjectMapper;import java.io.IOException;import java.io.OutputStream;import javax.ws.rs.GET;import javax.ws.rs.Path;import javax.ws.rs.PathParam;import javax.ws.rs.WebApplicationException;import javax.ws.rs.core.Context ...