Package org.jboss.ws.core.soap.attachment

Examples of org.jboss.ws.core.soap.attachment.AttachmentPartImpl


/* 148 */     return null;
/*     */   }
/*     */
/*     */   public AttachmentPart createAttachmentPart()
/*     */   {
/* 153 */     return new AttachmentPartImpl();
/*     */   }
View Full Code Here


/*     */   private AttachmentPart createAttachmentPart(ParameterMetaData paramMetaData, Object value, CIDGenerator cidGenerator) throws SOAPException, BindingException
/*     */   {
/* 673 */     String partName = paramMetaData.getXmlName().getLocalPart();
/* 674 */     Set mimeTypes = paramMetaData.getMimeTypes();
/*     */
/* 676 */     AttachmentPart part = new AttachmentPartImpl();
/* 677 */     if ((value instanceof DataHandler))
/*     */     {
/* 679 */       DataHandler handler = (DataHandler)value;
/* 680 */       String mimeType = MimeUtils.getBaseMimeType(handler.getContentType());
/*     */
/* 685 */       if ((mimeTypes != null) && (!MimeUtils.isMemberOf(mimeType, mimeTypes))) {
/* 686 */         this.log.warn("Mime type " + mimeType + " not allowed for parameter " + partName + " allowed types are " + mimeTypes);
/*     */       }
/* 688 */       part.setDataHandler((DataHandler)value);
/*     */     }
/*     */     else
/*     */     {
/* 692 */       String mimeType = null;
/* 693 */       if ((mimeTypes != null) && (mimeTypes.size() > 0))
/*     */       {
/* 695 */         mimeType = (String)mimeTypes.iterator().next();
/*     */       }
/*     */       else
/*     */       {
/* 699 */         mimeType = MimeUtils.resolveMimeType(value);
/*     */       }
/*     */
/* 702 */       if (mimeType == null) {
/* 703 */         throw new BindingException("Could not determine mime type for attachment parameter: " + partName);
/*     */       }
/* 705 */       part.setContent(value, mimeType);
/*     */     }
/*     */
/* 708 */     if (paramMetaData.isSwA())
/*     */     {
/* 710 */       String swaCID = '<' + partName + "=" + cidGenerator.generateFromCount() + '>';
/* 711 */       part.setContentId(swaCID);
/*     */     }
/* 713 */     if (paramMetaData.isXOP())
/*     */     {
/* 715 */       String xopCID = '<' + cidGenerator.generateFromName(partName) + '>';
/* 716 */       part.setContentId(xopCID);
/*     */     }
/*     */
/* 719 */     return part;
/*     */   }
View Full Code Here

   private AttachmentPart createAttachmentPart(ParameterMetaData paramMetaData, Object value, CIDGenerator cidGenerator) throws SOAPException, BindingException
   {
      String partName = paramMetaData.getXmlName().getLocalPart();
      Set mimeTypes = paramMetaData.getMimeTypes();

      AttachmentPart part = new AttachmentPartImpl();
      if (value instanceof DataHandler)
      {
         DataHandler handler = (DataHandler)value;
         String mimeType = MimeUtils.getBaseMimeType(handler.getContentType());

         // JAX-WS 2.0, 2.6.3.1 MIME Content
         // Conformance (MIME type mismatch): On receipt of a message where the MIME type of a part does not
         // match that described in the WSDL an implementation SHOULD throw a WebServiceException.
         if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes))
            log.warn("Mime type " + mimeType + " not allowed for parameter " + partName + " allowed types are " + mimeTypes);

         part.setDataHandler((DataHandler)value);
      }
      else
      {
         String mimeType = null;
         if (mimeTypes != null && mimeTypes.size() > 0)
         {
            mimeType = (String)mimeTypes.iterator().next();
         }
         else
         {
            mimeType = MimeUtils.resolveMimeType(value);
         }

         if (mimeType == null)
            throw new BindingException("Could not determine mime type for attachment parameter: " + partName);

         part.setContent(value, mimeType);
      }

      if (paramMetaData.isSwA())
      {
         String swaCID = '<' + partName + "=" + cidGenerator.generateFromCount() + '>';
         part.setContentId(swaCID);
      }
      if (paramMetaData.isXOP())
      {
         String xopCID = '<' + cidGenerator.generateFromName(partName) + '>';
         part.setContentId(xopCID);
      }

      return part;
   }
View Full Code Here

      return part;
   }

   private AttachmentPart createAttachmentPart(final String contentId, final DataHandler value)
   {
      AttachmentPart part = new AttachmentPartImpl();
      part.setContentId(contentId);
      part.setDataHandler(value);

      return part;
   }
View Full Code Here

      return null;
   }

   public AttachmentPart createAttachmentPart()
   {
      return new AttachmentPartImpl();
   }
View Full Code Here

TOP

Related Classes of org.jboss.ws.core.soap.attachment.AttachmentPartImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.