Use non-blocking, async API for BOSH servlet
After upgrading Jetty from the 7 to the 9 branch ( & ), an issue pops up where some BOSH requests will fail.
The direct cause of this issue is that sometimes, the InputStream from the HttpServletRequest returns nothing when being read.
A simplistic work-around for this problem is checking for availability of data (through InputStream.available()) and sleeping for a couple of milliseconds when that returns zero.
The root cause of the issue can be found in usage of the non-async API from an async context. Instead of using the non-async API, the newer async API should be used.
New implementation has been pushed and tested. Pidgin (via BOSH) gives odd behavior, but that was already the case before I applied the changes. Strophe, JSJac and Candy appear to work just fine with the new changes.