1 16 package org.apache.axis.attachments; 17 18 import org.apache.axis.AxisFault; 19 import org.apache.axis.Part; 20 import org.apache.axis.utils.Messages; 21 22 import javax.activation.DataHandler ; 23 24 29 public class AttachmentUtils { 30 31 private AttachmentUtils() { 32 } 33 35 42 public static DataHandler getActivationDataHandler(Part part) 43 throws AxisFault { 44 45 if (null == part) { 46 throw new AxisFault(Messages.getMessage("gotNullPart")); 47 } 48 49 if (!(part instanceof AttachmentPart)) { 50 throw new AxisFault( 51 Messages.getMessage( 52 "unsupportedAttach", part.getClass().getName(), 53 AttachmentPart.class.getName())); 54 } 55 56 return ((AttachmentPart) part).getActivationDataHandler(); 57 } 58 59 67 public static boolean isAttachment(Object value) { 68 69 if (null == value) { 70 return false; 71 } 72 73 return value instanceof javax.activation.DataHandler ; 74 } 75 } 76 | Popular Tags |