< prev index next >

src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/MessageImpl.java

Print this page




 873             return attachments.size();
 874         return 0;
 875     }
 876 
 877     @Override
 878     public void addAttachmentPart(AttachmentPart attachment) {
 879         try {
 880             initializeAllAttachments();
 881             this.optimizeAttachmentProcessing = true;
 882         } catch (Exception e) {
 883             throw new RuntimeException(e);
 884         }
 885         if (attachments == null)
 886             attachments = new FinalArrayList<>();
 887 
 888         attachments.add(attachment);
 889 
 890         needsSave();
 891     }
 892 
 893     static private final Iterator<AttachmentPart> nullIter = Collections.<AttachmentPart>EMPTY_LIST.iterator();
 894 
 895     @Override
 896     public Iterator<AttachmentPart> getAttachments() {
 897         try {
 898             initializeAllAttachments();
 899         } catch (Exception e) {
 900             throw new RuntimeException(e);
 901         }
 902         if (attachments == null)
 903             return nullIter;
 904         return attachments.iterator();
 905     }
 906 
 907     private void setFinalContentType(String charset) {
 908         ContentType ct = contentType();
 909         if (ct == null) {
 910             ct = new ContentType();
 911         }
 912         String[] split = getExpectedContentType().split("/");
 913         ct.setPrimaryType(split[0]);




 873             return attachments.size();
 874         return 0;
 875     }
 876 
 877     @Override
 878     public void addAttachmentPart(AttachmentPart attachment) {
 879         try {
 880             initializeAllAttachments();
 881             this.optimizeAttachmentProcessing = true;
 882         } catch (Exception e) {
 883             throw new RuntimeException(e);
 884         }
 885         if (attachments == null)
 886             attachments = new FinalArrayList<>();
 887 
 888         attachments.add(attachment);
 889 
 890         needsSave();
 891     }
 892 
 893     static private final Iterator<AttachmentPart> nullIter = Collections.EMPTY_LIST.<AttachmentPart>iterator();
 894 
 895     @Override
 896     public Iterator<AttachmentPart> getAttachments() {
 897         try {
 898             initializeAllAttachments();
 899         } catch (Exception e) {
 900             throw new RuntimeException(e);
 901         }
 902         if (attachments == null)
 903             return nullIter;
 904         return attachments.iterator();
 905     }
 906 
 907     private void setFinalContentType(String charset) {
 908         ContentType ct = contentType();
 909         if (ct == null) {
 910             ct = new ContentType();
 911         }
 912         String[] split = getExpectedContentType().split("/");
 913         ct.setPrimaryType(split[0]);


< prev index next >