Examples of MIMEPart


Examples of org.eclipse.wst.wsi.internal.core.log.MimePart

    Iterator iparts = parts.iterator();
    int i = 0;
    while (iparts.hasNext())
    {
      i = i + 1;
      MimePart part = (MimePart)iparts.next();
      String m_partName = MIMEUtils.getMimeHeaderAttribute(
          part.getHeaders(), MIMEConstants.HEADER_CONTENT_ID);

      // check value format <partname=UID@hostname>
      if ((m_partName != null) && m_partName.startsWith("<") && m_partName.endsWith(">"))
      {
        int idx, atIdx;
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.log.MimePart

      else
      {
        // check each part for the encoding match
        Iterator iparts = parts.getParts().iterator();
        int i = 0;
        MimePart root = parts.getRootPart();
        while (iparts.hasNext())
        {
          i = 1;
          try
          {
          MimePart part = (MimePart)iparts.next();
         
            // get encoding from header
            String encoding =  HTTPUtils.getHttpHeaderAttribute(part.getHeaders(),
              HTTPConstants.HEADER_CONTENT_TRANSFER_ENCODING);
         
             if ((part == root) ||
               ((encoding != null) && encoding.equalsIgnoreCase("base64")))
              checkPart(part, encoding, false);
View Full Code Here

Examples of org.jvnet.mimepull.MIMEPart

          if (boundary == null || boundary.equals("")) {
              throw new WebServiceException("MIME boundary parameter not found" + contentType);
          }
          
          MIMEMessage message =  new MIMEMessage(input, boundary);
          MIMEPart  jsonPart  = null;   
      for(MIMEPart mimeAttach : message.getAttachments()){
        if(mimeAttach.getContentType().equalsIgnoreCase(JSONContentType.JSON_MIME_TYPE)) {
          jsonPart  = mimeAttach;
          break;
        } else {
          List<String> contentDisposition = mimeAttach.getHeader(JSONCodec.CONTENT_DISPOSITION_HEADER);
          if(contentDisposition != null && contentDisposition.size() > 0){
            try {
              ContentDisposition disp = new ContentDisposition(contentDisposition.get(0));
              if(disp.getParameter("name") != null && disp.getParameter("name").equals(JSON_PARAM_NAME)){
                jsonPart = mimeAttach;
                break;
              }
            } catch (ParseException e) {}
          }
        }
      }
      if(jsonPart == null){
        throw new RuntimeException(String.format("There is no request JSON found in multipart mime. Your JSON input http \"parameter\"" +
            " must be named as \"%s\" or pass %s: <Your json param name>. In alternate case body part content type should be %s " +
            " json content as mime part body.", JSONCodec.XJSONPARAM_DEFAULT, JSONCodec.XJSONPARAM_HEADER, JSONContentType.JSON_MIME_TYPE));
      }
      List<MIMEPart> attachments = message.getAttachments();
      /*
       * Remove JSON part from attachment list. JSON part reseved for codec. and handled by JSONDecoder.
       *
       */
      attachments.remove(jsonPart);
      /*
       * Put attachemnts into invoke properties of packet.
       */
      this.packet.invocationProperties.put(JSONCodec.MIME_ATTACHMENTS,attachments);
      /*
       * Decode message
       */
      com.sun.xml.ws.api.message.Message wsMessage = new JSONDecoder(this.codec,jsonPart.readOnce(),packet).getWSMessage();
      /*
       * Remove attachment. Else same packet object used in response. It leads attachment fall back in response.
       */
      this.packet.invocationProperties.remove(JSONCodec.MIME_ATTACHMENTS);
      /*
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.