WS Download operation with MTOM

折月煮酒 提交于 2019-12-06 09:38:30

I tried experimenting and finally i had some positive results.

In order to stream from DB directly to clients browser the above things are valid but the InputStreamDataSource should be like this:

public class InputStreamDataSource implements DataSource {
    private InputStream inputStream;

    public InputStreamDataSource(InputStream inputStream) {
        this.inputStream = inputStream;
    }

    public InputStream getInputStream() throws IOException {
        return inputStream;
    }

    public OutputStream getOutputStream() throws IOException {
        throw new UnsupportedOperationException("Not implemented");
    }

    public String getContentType() {
        return "*/*";
    }

    public String getName() {
        return "InputStreamDataSource";
    }
}

What I was affraid is that once I closed the input stream myself... the ws client did not received the binary content...

Than i check and actually the DataHandler creates a new thread and closes the input stream

I was able to stream 500MB from DB to client fast and with low memory footprint !

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!