I have a Swing client that needs to "upload" and "download" large files from the server. The files are larger than available memory, so they must be streamed. Currently, I've been using Spring's HttpInvoker (actually, a modified version of it) to transparently remote my service interfaces. Everything has been working well. Now, I know that HttpInvoker does not support streaming - but it sure would be nice if it could. So, I thought I would start this thread with the hope of brainstorming with others how this could be approached. Note, my goal is to keep with the Spring spirit and support streaming in a transparent and easy manner. Of course, I could just write a servlet or something, but then I wouldn't get my nifty transparent Spring goodness.
Ideally, it would be awesome to be able to do something like this:
This is just an example, of course. Now, imagine if I could do something like this on the client side:Code:public interface MyService { public void storeContent(String id, InputStream content); public InputStream getContent(String id); }
HttpInvoker would just magically somehow stream that InputStream across the wire to the server side where you could just read from that InputStream and do whatever you need with it.Code:InputStream fileContent = new BufferedInputStream(new FileInputStream(file)); try { myService.storeContent(id, fileContent); } finally { fileContent.close(); }
Has anyone done anything like this? Think it would be difficult to implement? I'm thinking that HttpInvoker could be taught to notice when an InputStream is the last parameter to a method, and then handle that InputStream in some special manner. In the same way, it could notice when a method returns an InputStream.
- Andy



Reply With Quote
