jsons.add(JsonIO.toJson(meta));
}
- return newInputStreamResponse("application/json",
- new ByteArrayInputStream(
- new JSONArray(jsons).toString().getBytes()));
+ return NanoHTTPD.newFixedLengthResponse(Status.OK,
+ "application/json", new JSONArray(jsons).toString());
}
return NanoHTTPD.newFixedLengthResponse(Status.BAD_REQUEST,
NanoHTTPD.MIME_PLAINTEXT, "Error when processing request");
}
}
-
+
protected Response newInputStreamResponse(String mimeType, InputStream in) {
if (in == null) {
return NanoHTTPD.newFixedLengthResponse(Status.NO_CONTENT, "",