Data Streaming from Java EE Application Server
ejb, jakarta-ee, java, jboss, streaming
Solution
Create a HttpServlet, stream the file.
update Be careful with your header. You cannot set the ContentLength-Header via `setContentLength()`, because it only accept `int`.
You wil have to set it with: `setHeader("Content-Length", (long)length)`
Maybe this will be helpful: Using ServletOutputStream to write very large files in a Java servlet without memory issues
There is a limit, but it depends on the client-side. If the client will hold the file in the memory, it will not work.
Problem
I need to retrieve from an Application Server (JBoss) a large file (gigabytes) and to avoid loading it in memory, I want to stream it through EJB. Is it possible to take data out of an Application Server as a stream?