1 55 56 package org.jboss.axis.encoding.ser; 57 58 import org.jboss.axis.encoding.DeserializationContext; 59 import org.jboss.logging.Logger; 60 import org.xml.sax.Attributes ; 61 import org.xml.sax.SAXException ; 62 63 import javax.activation.DataHandler ; 64 import javax.mail.internet.MimeMultipart ; 65 66 71 public class MimeMultipartDataHandlerDeserializer extends JAFDataHandlerDeserializer 72 { 73 private static Logger log = Logger.getLogger(MimeMultipartDataHandlerDeserializer.class.getName()); 74 75 public void startElement(String namespace, String localName, 76 String prefix, Attributes attributes, 77 DeserializationContext context) 78 throws SAXException 79 { 80 81 super.startElement(namespace, localName, prefix, attributes, context); 82 83 if (getValue() instanceof DataHandler ) 84 { 85 try 86 { 87 DataHandler dh = (DataHandler )getValue(); 88 MimeMultipart mmp = new MimeMultipart (dh.getDataSource()); 89 if (mmp.getCount() == 0) 90 { 91 mmp = null; 92 } 93 setValue(mmp); 94 } 95 catch (Exception e) 96 { 97 throw new SAXException (e); 98 } 99 } 100 } } | Popular Tags |