axis2 - How to stream Axis 2 MTOM temp file to HttpServletRequest -


i'm using code below retrieve attachment webserver. client in case web browser. currently, user makes request webserver attachment. webserver makes mtom request server attachment. webserver waits attachment download before begins writing attachment out response. user waiting twice long file. how can tap axis2 code access temp file can stream user being created? know doesn't sound best way this, requirement. i'm working large files 2gb, waiting twice long recieve file isn't working out.

options options = new options(); options.setto(new endpointreference(this.endpointurl)); options.settransportinprotocol(constants.transport_http); options.setproperty(constants.configuration.enable_mtom, constants.value_true); options.setproperty(constants.configuration.cache_attachments, constants.value_true); options.setproperty(constants.configuration.attachment_temp_dir, this.tempdirectory); options.setproperty(constants.configuration.file_size_threshold, string.valueof(this.tempfilesizethreshold)); options.settimeoutinmilliseconds(this.servicerequesttimeout);  sender = new serviceclient(); sender.setoptions(options);  omelement result = sender.sendreceive(this.getattachmentpayload(productid, attachmentid));  omelement attachmentelement = result.getfirstelement();  iterator<omelement> elementiterator = attachmentelement.getchildelements();  string filename = ""; datahandler datahandler = null;  while (elementiterator.hasnext()) {     omelement element = elementiterator.next();      if (element.getqname().getlocalpart().equals("name")) {         filename = element.gettext();     } else if (element.getqname().getlocalpart().equals("attachment")) {         datahandler = (datahandler) ((omtext) element.getfirstomchild()).getdatahandler();     } } 

org.w3.www._2005._05.xmlmime.base64binary b64data = ---your_source_attachment---;  org.apache.axiom.attachments.cachedfiledatasource ds = (cachedfiledatasource) b64data.getbase64binary().getdatasource();  string abspath = ds.getfile().getabsolutepath(); 

Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -