2 Replies Latest reply on Mar 12, 2015 4:11 PM by Jonathan Fields

    Help migrating servlet from JBossWEB to Undertow

    Jonathan Fields Novice

      Hi, I hope this is the correct forum for this question. It did not seem that there was an Undertow-specific forum, if I'm wrong please let me know.


      I am attempting to migrate a servlet from JBoss Web 7 (JBoss AS 7) that uses the native APR (Apache Portable Runtime) and the "sendfile" optimization to efficiently send large files that reside outside of the webapp root.  In the doGet() method:


      1. The request URI is used to lookup an physical file path (external to the webapp root) in a database.

      2. Perform some other checks, and send back the appropriate HTTP response codes if there are errors (e.g. authentication).

      3. The physical file path is then used the ResponseFacade.sendFile() call to instruct API to send the file asynchronously using the "sendfile" optimization in APR.

      I am trying to understand how I can accomplish the same result using Undertow. From the documentation and code, I can see that in normal circumstances, Undertow will send files in the webapp root larger than a certain threshold using NIO (which presumably results in the use of sendfile).


      However, I cannot quite understand how I would extend Undertow to what I am doing my servlet as described above. Any pointers or examples or hints would be greatly appreciated.