I have an EJB client that needs to retrieve a large file from an EJB server (JBoss).
The evident way to implement this is the server to offer a EJB facade with a method like this one:
public byte[] getFile(String fileName);
That means, loading the whole file in memory, in a byte array, and then sending this byte array on the wire.
The problem is that this approach loads the whole file in memory, and since the file is huge, it would overflow it.
Is there any option to overcome this problem?