[Hessian-interest] InputStreamDeserializer

Niclas Olofsson nicke.olofsson at gmail.com
Fri Jul 25 21:20:35 CDT 2008


Scott Ferguson skrev:
> There's an unresolved difficulty in reading large data from Hessian.   
> In your original solution, the buffer would need to contain the entire  
> response.  What I've wanted to do is add some kind of configurable  
> handler, so applications could choose to buffer the output as  
> appropriate for the application, e.g. writing to a temp file if it's  
> very large.

That solution is commonly used in web-projects too, so why not. Should 
be easy enough to implement.

http://commons.apache.org/fileupload/using.html

I could also imagine that you would allow something like ..

public List<UploadResult> uploadImages(Metadata[], InputStream[])

.. where you would be required to read the streams in the array in the 
order they are delivered in the array (and close them as usual). That 
would cover a lot of use cases too. I would like to use the last one 
where I have very large files that I want to send metadata and get 
metadata back, all in a transaction. The streams in my case would be 
chained to a database without buffering.

The main motivation for me to do like this is twofold. First it's a 
matter of transactions, the other is ease of use by being able to send 
and receive metadata about the transfer. We use a servlet right now 
(because we couldn't get this working in C#) with a very flaky 
transaction management and very painful metadata handling. Anything that 
works would beat our current solution.

And .. I can think of a dozen other solutions .. most bad .. all 
implementation specific. And I don't see a problem with it. Really. I 
don't mind that hessian implementations use conventions and impose 
limitiations to do what we need it to do. It's still does the job much 
easier than anything else. All this is to me .. borderline overkill 
anyway. If someone (like me) want to use Hessian for stuff like this, I 
believe I can accept the limitations too.

BUT, I think the biggest problem for me would be this:

public InputStream[] downloadImages(...);

No metadata. But in this case, transactions wouldn't be a problem, so I 
could easily live with several requests of InputStream 
downloadImage(...). OR get them in the same order in the array as I 
requested them (up to me). It's still easier than most other solutions I 
can imagine :-)

Cheers,
/Niclas




More information about the hessian-interest mailing list