Transfer large messages with Apache CXF
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.
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.
精彩评论