1 16 17 package org.apache.axis.encoding.ser; 18 19 import org.apache.axis.components.logger.LogFactory; 20 import org.apache.axis.encoding.DeserializationContext; 21 import org.apache.commons.logging.Log; 22 import org.xml.sax.Attributes ; 23 import org.xml.sax.SAXException ; 24 25 import javax.activation.DataHandler ; 26 import javax.mail.internet.MimeMultipart ; 27 28 32 public class MimeMultipartDataHandlerDeserializer extends JAFDataHandlerDeserializer { 33 protected static Log log = 34 LogFactory.getLog(MimeMultipartDataHandlerDeserializer.class.getName()); 35 36 public void startElement(String namespace, String localName, 37 String prefix, Attributes attributes, 38 DeserializationContext context) 39 throws SAXException { 40 41 super.startElement(namespace, localName, prefix, attributes, context); 42 43 if (getValue() instanceof DataHandler ) { 44 try { 45 DataHandler dh = (DataHandler ) getValue(); 46 MimeMultipart mmp = new MimeMultipart (dh.getDataSource()); 47 if (mmp.getCount() == 0) { 48 mmp = null; 49 } 50 setValue(mmp); 51 } 52 catch (Exception e) { 53 throw new SAXException (e); 54 } 55 } 56 } } | Popular Tags |