开发者

Spring ws : how to access to the size of an AxiomAttachment

开发者 https://www.devze.com 2023-01-13 10:00 出处:网络
In order to get an attachment i have the following code in an endpoint : @PayloadRoot(localPart = REQUEST_ELEMENT, namespace = MODELES_V1_0_URI)

In order to get an attachment i have the following code in an endpoint :

@PayloadRoot(localPart = REQUEST_ELEMENT, namespace = MODELES_V1_0_URI)
@ResponsePayload
public Source saveFile(MessageContext argo) throws Exception {

 (AxiomSoapMessage)MessageContextHolder.getMessageContext().getRequest();
 AxiomSoapMessage request = (AxiomSoapMessage)argo.getRequest();
 Attachment attachement= request.getAttachments().next();

But the attachment implements AxiomAttachment (i'm using Axi开发者_JAVA百科omSoapMessageFactory) and according to this class " Axiom does not support getting the size of attachments.".

How can i get the size of the attachement ?

Iv try to use this in order to be able to send big files (more than 10 mo) as an attachement to prevent an outofMemory (any better idea will be appreciate - i have already try the mtom spring sample but it doesnt work with heavy file (outOfMemory too) even by specifying the AxiomSoapMessageFactory).

Im open to any better solution (the spring ws mtom sample doesnt work..) for dealing with heavy file with spring ws


It's not really possible to get the size of a file before you save it off from the DataHandler. Think about it. MTOM is a technology to stream binary files to a web service. The question you've asked is akin to saying "How long is this telephone call going to last?" You can't know for sure until you've hung up the phone.

0

精彩评论

暂无评论...
验证码 换一张
取 消