All,

I am using Axis1.4. When doing attachment, I found it seems no elegant
way to pass the file name attached. Below is my source code fragment:

                String sourceDir = "C:\\temp\\example.doc";
            //Get the file from the filesystem
            FileDataSource fileDS = new FileDataSource(sourceDir);
            DataHandler handler = new DataHandler(fileDS);

            //Create the attachment as a MTOM attachment
            AttachmentPart attachment = message.createAttachmentPart();
            String fileName = getFileName(sourceDir);
            attachment.addMimeHeader(DocumentDescriptor.FILE_NAME,
fileName);
 
message.getAttachmentsImpl().setSendType(
                        AttachmentsImpl.SEND_TYPE_MTOM);
            attachment.setDataHandler(handler);
            message.addAttachmentPart(attachment);

 

As you saw above, I have to add one more MimeHead to pass the file name.
It works but I think there must be better way to do this. Any idea?

Thanks
 
Tim Jian
Momentum systems, Inc.




NOTICE: This message (including any attachments) from Momentum Systems, Inc. 
contains information that is PRIVILEGED and CONFIDENTIAL.  If you are not an 
intended recipient, you are hereby notified that any dissemination of this 
message is strictly prohibited.  If you have received this message in error, 
please do not read, copy or forward this message.  Please permanently delete 
all copies and any attachments and notify the sender immediately by reply email 
or by calling our Office at 703.740.9300.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to