public void handleRequest(HttpServerExchange exchange) throws Exception {
if (exchange.isInIoThread()) {
exchange.dispatch(this);
return;
}
exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
exchange.startBlocking();
OutputStream out = exchange.getOutputStream();
writeToStream(out); //query database and write rows to out
exchange.endExchange();
}
is this the way to correctly write a chunked http response?