<div dir="ltr">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.<div>
<br></div><div>I currently have this:<br><div><br></div><div><p style="margin:0px;font-size:11px;font-family:Monaco"><span style="color:rgb(147,26,104)">public</span> <span style="color:rgb(147,26,104)">void</span> handleRequest(HttpServerExchange <span style="color:rgb(126,80,79)">exchange</span>) <span style="color:rgb(147,26,104)">throws</span> Exception {</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                        </span><span style="color:rgb(147,26,104)">if</span> (<span style="color:rgb(126,80,79)">exchange</span>.isInIoThread()) {</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                                </span><span style="color:rgb(126,80,79)">exchange</span>.dispatch(<span style="color:rgb(147,26,104)">this</span>);</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(147,26,104)"><span style="color:rgb(0,0,0)"><span class="" style="white-space:pre">                                </span></span>return<span style="color:rgb(0,0,0)">;</span></p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                        </span>}</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                        </span><span style="color:rgb(126,80,79)">exchange</span>.getResponseHeaders().put(Headers.<span style="color:rgb(3,38,204)">CONTENT_TYPE</span>, <span style="color:rgb(57,51,255)">"text/plain"</span>);</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                        </span><span style="color:rgb(126,80,79)">exchange</span>.startBlocking();</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                        </span>OutputStream <span style="color:rgb(126,80,79)">out</span> = <span style="color:rgb(126,80,79)">exchange</span>.getOutputStream();</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                        writeToStream(out); //query database and write rows to out</span></p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                        </span><span style="color:rgb(126,80,79)">exchange</span>.endExchange();</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                </span>}</p><p style="margin:0px;font-size:11px;font-family:Monaco"><br></p><p style="margin:0px;font-size:11px;font-family:Monaco">
<span style="font-family:arial;font-size:small">is this the way to correctly write a chunked http response?</span><br></p></div></div></div>