In XWiki 16.2.0, JAX-RS 2.1 is available which should allow us to implement streaming responses with proper APIs instead of forwarding the response line by line.