Announcement Announcement Module
Collapse
No announcement yet.
Transfer large files via Hessian Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transfer large files via Hessian

    This question has been asked a couple of times before, but there doesn't appear to be a complete answer yet, so I'm going to ask again. Here are the references to the previous questions:

    http://forum.springframework.org/viewtopic.php?t=1179

    http://forum.springframework.org/viewtopic.php?t=1186

    The Hessian code examples included in those two posts appear to be adapted from the code snippet on the Caucho Hessian web site:

    http://www.caucho.com/resin-3.0/prot...ge-binary-data

    The idea being that if you're transfering a large amount of data between client/server in a Hessian call, you're better off handling the data transfer yourself with streams, rather than allowing Hessian to buffer the big file in memory before it handles the transfer for you.

    I am trying to implement this very thing: big file upload/download.

    But, I can't figure out how to use the Spring wrappers around the Hessian classes in order to gain access to the HessianInput and HessianOutput streams I need. Here's the example code snippet from the last URL I listed above:

    OutputStream os = conn.getOutputStream();

    HessianOutput out = new HessianOutput(os);
    out.startCall("download");
    out.writeString("my-file.txt");
    out.completeCall();

    InputStream is = conn.getInputStream();

    HessianInput in = new HessianInput(is);

    in.startReply();

    InputStream is = in.readInputStream();

    ... // save the input stream data somewhere

    in.completeReply();

    Thanks!

    Peter

  • #2
    I had to solve this very problem, and I did by brute force, without using spring remoting at all, just mimicking its behaviour. I created a specialized servlet on the server side that can process multiparts using commons-fileupload, and on the client side I've used httpclient to
    invoke the servlet.

    Basically, I'm doing POST requests, every parameter in the remote call is a field in the POST request, and some happen to be InputStreams and OutputStreams handled internally by a multipart POST. The response is a serialized object that contains a result (serialized) and eventually an exception, just like the way Spring remoting is working.

    Hope this helps.

    Comment


    • #3
      I'm facing the exact same problem now. Has there been any development over the past couple months to ease this burden? Were you forced to interact directly w/ the Hessian API?

      Unfortunately it appears Spring changed their board software, so the links you present are not working any longer, either.

      Comment

      Working...
      X