使用 Apache CXF 传输大消息

发布于 2024-09-26 06:03:14 字数 133 浏览 1 评论 0原文

我正在编写 CXF WS 来上传一些大文件 - 最多 1GB。在大多数情况下,它们不会> 10-15MB,但问题是加载文件并使用标准绑定将其作为常规 byte[] 发送是无效的。因此,可能需要自定义拦截器,但我不确定它是唯一的选择以及如何编写它。

I'm writing a CXF WS to upload some large files - up to 1GB. In most cases they won't be >10-15MB, but the problem is that it is ineffective to load the file and send it as regular byte[] using the standard binding. For that reason a custom interceptor might be needed but I'm not sure it is the only option as well as how to write it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

星星的軌跡 2024-10-03 06:03:14

CXF 支持 MTOM 规范,并为二进制数据提供更高效的传输编码,而且还为使用 JAXB 绑定提供了更灵活的 API。这将二进制数据与 byte[] 解耦,并将其替换为 DataHandler,它允许您从流而不是 byte[].这适用于连接的客户端和服务器端。

CXF supports the MTOM specification, which as well as providing a more transmission-efficient encoding for binary data, but also provides a more flexible API for binding using JAXB. This decouples the binary data from byte[] and replaced it with a DataHandler, which allows you to source the data from streams, rather than byte[]. This applies both to client and server ends of the connection.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文