Examples of MimeMessage


Examples of javax.mail.internet.MimeMessage

    if (null==oPg) throw new MessagingException("DBFolder.copyMessage() Source Message not found");

    DBFolder oSrcFldr = (DBFolder) oSrcMsg.getFolder();

    MboxFile oMboxSrc = null;
    MimeMessage oMimeSrc;
    String sNewGuid = null;
    try {
      if ((oSrcFldr.mode&MODE_MBOX)!=0) {
        if (DebugFile.trace) DebugFile.writeln("new MboxFile(" + oSrcFldr.getFile() + ", MboxFile.READ_ONLY)");
        oMboxSrc = new MboxFile(oSrcFldr.getFile(), MboxFile.READ_ONLY);
        InputStream oInStrm = oMboxSrc.getMessageAsStream(oPos.longValue(), iLen);
        oMimeSrc = new MimeMessage(Session.getDefaultInstance(new Properties()), oInStrm);
        oInStrm.close();
        oMboxSrc.close();
        oMboxSrc=null;

        String sId2 = oMimeSrc.getMessageID();
        if ((sId!=null) && (sId2!=null)) {
          if (!sId.trim().equals(sId2.trim())) {
            throw new MessagingException("MessageID "+ sId + " at database does not match MessageID " + oMimeSrc.getMessageID() + " at MBOX file " + oSrcFldr.getFile().getName() + " for message index " + oPg.toString());
          }
        } // fi (sId!=null && sId2!=null)

        appendMessage(oMimeSrc);
      }
      else {
        ByteArrayOutputStream oByOutStrm = new ByteArrayOutputStream();
        oSrcMsg.writeTo(oByOutStrm);
        ByteArrayInputStream oByInStrm = new ByteArrayInputStream(oByOutStrm.toByteArray());
        oByOutStrm.close();
        oMimeSrc = new MimeMessage(Session.getDefaultInstance(new Properties()), oByInStrm);
        oByInStrm.close();
        appendMessage(oMimeSrc);
      }
    }
    catch (Exception e) {
View Full Code Here

Examples of org.jvnet.mimepull.MIMEMessage

        String boundary = contentType.getParameter("boundary");
          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);
 
View Full Code Here

Examples of org.springframework.ws.mime.MimeMessage

    @Test
    public void testInvokeMimeMarshaller() throws Exception {
        MimeUnmarshaller unmarshaller = createMock(MimeUnmarshaller.class);
        MimeMarshaller marshaller = createMock(MimeMarshaller.class);
        MimeMessage request = createMock("request", MimeMessage.class);
        MimeMessage response = createMock("response", MimeMessage.class);
        Source requestSource = new StringSource("<request/>");
        expect(request.getPayloadSource()).andReturn(requestSource);
        expect(factoryMock.createWebServiceMessage()).andReturn(response);
        expect(unmarshaller.unmarshal(eq(requestSource), isA(MimeContainer.class))).andReturn(42L);
        Result responseResult = new StringResult();
        expect(response.getPayloadResult()).andReturn(responseResult);
        marshaller.marshal(eq("result"), eq(responseResult), isA(MimeContainer.class));

        replay(factoryMock, unmarshaller, marshaller, request, response);

        AbstractMarshallingPayloadEndpoint endpoint = new AbstractMarshallingPayloadEndpoint() {
View Full Code Here

Examples of rath.msnm.msg.MimeMessage

      while(!bSuccess && retry < messageSendingRetryCnt){
   
        String friendLoginName = toEMailAddress;
   
                msn.doCallWait(friendLoginName)
                MimeMessage sendMessage = new MimeMessage(messageContent); //�޼��� ����
                sendMessage.setKind(MimeMessage.KIND_MESSAGE);
                if (msn.sendMessage(friendLoginName , sendMessage) == true )   //�޼��� �����ºκ�
                {
                        System.out.println("Success");
                       
                        bSuccess=true;
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.