[undertow-dev] blocking IO

Machiel Groeneveld machielg at gmail.com
Wed Jun 18 16:21:44 EDT 2014


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20140618/aa9a181f/attachment-0001.html 


More information about the undertow-dev mailing list