Can a web service return a stream?

前端 未结 12 1729
眼角桃花
眼角桃花 2021-02-02 09:23

I\'ve been writing a little application that will let people upload & download files to me. I\'ve added a web service to this applciation to provide the upload/download fun

12条回答
  •  臣服心动
    2021-02-02 09:43

    The RMIIO library for Java provides for handing a RemoteInputStream across RMI - we only needed RMI, though you should be able to adapt the code to work over other types of RMI . This may be of help to you - especially if you can have a small application on the user side. The library was developed with the express purpose of being able to limit the size of the data pushed to the server to avoid exactly the type of situation you describe - effectively a DOS attack by filling up ram or disk.

    With the RMIIO library, the server side gets to decide how much data it is willing to pull, where with HTTP PUT and POSTs, the client gets to make that decision, including the rate at which it pushes.

提交回复
热议问题