<div dir="ltr">Hi,<br><br>I&#39;m implementing custom HTTP reverse proxy using Undertow.<br>My server is listening to requests and when a new request arrives, It wraps the request in a proprietary protocol and redirect to another component in my system.<br>That component takes the request data, unpack it, send it to the actual web server, get&#39;s the response and send the response back to my Undertow server in the same proprietary protocol.<br>The server unpacks the response and writes it back to the user&#39;s browser.<br><br>All works very well for &quot;small&quot; requests/response but for request/response that has body data that exceed some predefined amount I would like to split the request/response to chunks ( my own chunking mechanism, not related to HTTP chunking) to better handle such scenarios and not hold the entire data in the server&#39;s memory.<br><br>In order to do that I need access to the request/response body bytes,<br>I came by this thread: <a href="http://lists.jboss.org/pipermail/undertow-dev/2015-January/001080.html">http://lists.jboss.org/pipermail/undertow-dev/2015-January/001080.html</a> and tried to implement both proposed solutions<br><br>When I used the async interface:<br><br>HttpServerExchange.getResponseSender().send(bodyByteBuffer, myIoCallback)<br><br>Sometimes my callback just not called ( nor the onComplete or the onException callbacks) for unknown reasons.<br><br>So I tried the blocking interface instead ( from dispatched handler ):<br><br>HttpServerExchange.startBlocking()<br><br>HttpServerExchange.getResponseSender().send(bodyByteBuffer)<br><br>That works but I read somewhere in this mailing list that the async interface is more efficient.<div><br></div><div>The same behavior occurred when trying to receive the request body using:</div>HttpServerExchange.getRequestReceiver()<div>and also solved using the blocking interface.</div><div><br></div><div>Am I missing something? what are the best practices for reading/writing partial request/response body?</div><div><br></div><div>Best,</div><div>Eldad.<br><div><br><div><br></div></div></div></div>