I have a question about the blocking IO. In the documentation there is mention of the startBlocking call but not of spinning threads. I'm mentioning this because in the FileResource.java (a supplied handler in undertow) the file seems to be served from a new thread.

I currently have this:

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?