[jboss-user] [Remoting] - Re: sending Streams using POJOS

caultonpos do-not-reply at jboss.com
Sat Jul 14 12:34:13 EDT 2007

Tom, this feature of streaming a file from the server to the client is very important for my application.  I have a Swing fat client with many use cases whereby I need to exchange images or file attachments with the server over RMI.

To upload files your implementation was elegant and testing GB files works very well.

remotingClient = new Client(new InvokerLocator(streamLocatorURL));
remotingClient.invoke(fileInput, file.getFilePath());

I do not store these files in the database (they could be up 150MB in size).  Rather I store in a filesystem with the database containing the meta data - file device, name, location, size, etc.

I need these files back of course so I need the reverse of your upload
OutputStream out = ... (ByteArrayOutputStream or FileOutputStream as needed)
remotingClient = new Client(new InvokerLocator(streamLocatorURL));
remotingClient.invoke(fileOutput, parameter);

In my case the parameter will be the primary key to the meta data so that the server can find the file.  As in the upload, just providing an Object parameter is fine for me.

On the server I would implement:

public Object handleStream(OutputStream stream, InvocationRequest param);

I use the param to find the file and write the file to the stream.

Let me know if this is feasible, I would love to see this out before the end of the year - the alternatives are not pretty - return the byte[] of the entire file (obvious performance issue) or setup some kind of ftp service bean but all sorts of security issues there.

I'm not sure what other alternatives I have.

I will log a Jira referencing this thread



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4064237#4064237

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4064237

More information about the jboss-user mailing list