Set the message body converters to use. These converters are used to
convert objects to MIME parts.
6655
public void setPartConverters(List<HttpMessageConverter> partConverters) {
        checkNotNull(partConverters, "'partConverters' must not be null");
        checkArgument(!partConverters.isEmpty(), "'partConverters' must not be empty");
        this.partConverters = partConverters;
    }
210664
@Override
	public void body() {

		IMessageEvent msg = (IMessageEvent) getReason();

		String content = (String) msg.getParameter("content").getValue();

		if (content.equalsIgnoreCase("UnknownLanguageCall")) {
			this.getBeliefbase().getBelief("operatorTalking").setFact(true);

			try {

				String type = (String) msg.getParameter("performative")
						.getValue();
				String agent_name = (String) ((IComponentIdentifier) msg
						.getParameter(SFipa.SENDER).getValue()).getLocalName();

				String answer = (String) ((AgentBehaviour) getBeliefbase()
						.getBelief("agent_behaviour").getFact())
						.processMessage(type, agent_name, content);
				if (answer == null)
					answer = "Unknown required action";

				IMessageEvent msgResp = getEventbase().createReply(msg,
						"send_inform");
				msgResp.getParameter(SFipa.CONTENT).setValue(answer);

				sendMessage(msgResp);

			} catch (Exception e) {
				// Not important for tutorial purposes.
			}
		}

	}
205420
public void setBody(final WComponent body) {
		DecoratedLabelModel model = getOrCreateComponentModel();

		if (body == null) {
			throw new IllegalArgumentException("Body content must not be null");
		}

		if (model.body != null) {
			remove(model.body);
		}

		model.body = body;
		add(body);
	}
614545
private void resetInputStreams() throws IOException, MessagingException {
        for (int ix = 0; ix < this.getCount(); ix++) {
            BodyPart part = this.getBodyPart(ix);
            if (part.getContent() instanceof MimeMultipart) {
                MimeMultipart subContent = (MimeMultipart) part.getContent();
                for (int jx = 0; jx < subContent.getCount(); jx++) {
                    BodyPart subPart = subContent.getBodyPart(jx);
                    if (subPart.getContent() instanceof ByteArrayInputStream) {
                        ((ByteArrayInputStream) subPart.getContent()).reset();
                    }
                }
            }
        }
    }
1114731
public Object convertToMessage()
    {
        try {
            Object reply = this.getRawData();

            org.w3c.dom.Node nodeBody = this.getMessageBody(reply, false);

            if (this.getConvertToMessage() == null)
                return null;
            Object msg = this.getConvertToMessage().unmarshalRootElement(nodeBody, this);

            return msg;
        } catch(Throwable ex) {
            this.setMessageException(ex);
        }
        return null;    // Error
    }
504232
protected void updateBodyLengthHeaders(HttpBaseMessage msg) {

        // don't change headers if this was in response to a HEAD request
        if (!getRequestImpl().getMethodValue().equals(MethodValues.HEAD)) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Body not valid on response, fixing headers");
            }
            if (0 < msg.getContentLength()) {
                // 366388
                msg.removeHeader(HttpHeaderKeys.HDR_CONTENT_LENGTH);
            }
            msg.setTransferEncoding(TransferEncodingValues.NOTSET);
        }
    }
585011
public void setBinaryMediaTypes(List<MediaType> binaryMediaTypes) {
        requestMessageConverters.stream()
                                .filter(converter -> converter instanceof ByteArrayHttpMessageConverter)
                                .map(ByteArrayHttpMessageConverter.class::cast)
                                .forEach(converter -> converter.setSupportedMediaTypes(binaryMediaTypes));

        responseMessageConverters.stream()
                                .filter(converter -> converter instanceof ByteArrayHttpMessageConverter)
                                .map(ByteArrayHttpMessageConverter.class::cast)
                                .forEach(converter -> converter.setSupportedMediaTypes(binaryMediaTypes));
    }
1228523
def to_message(self):
        

        self.validate()
        
        bodies = [(self.body, 'text/plain'), (self.html, 'text/html')]

        for idx, (val, content_type) in enumerate(bodies):
            if val is None:
                bodies[idx] = None
            elif isinstance(val, Attachment):
                bodies[idx] = val.to_mailbase(content_type)
            else:
                # presumed to be a textual val
                attachment = Attachment(
                    data=val,
                    content_type=content_type,
                    transfer_encoding='quoted-printable',
                    disposition='inline'
                    )
                bodies[idx] = attachment.to_mailbase(content_type)

        body, html = bodies

        base = MailBase([
            ('To', ', '.join(self.recipients)),
            ('From', self.sender),
            ('Subject', self.subject),
            ])

        # base represents the outermost mime part; it will be one of the
        # following types:
        #
        # - a multipart/mixed type if there are attachments.  this
        #   part will contain a single multipart/alternative type if there
        #   is both an html part and a plaintext part (the alternative part
        #   will contain both the text and html), it will contain
        #   a single text/plain part if there is only a plaintext part,
        #   or it will contain a single text/html part if there is only
        #   an html part.  it will also contain N parts representing
        #   each attachment as children of the base mixed type.
        #
        # - a multipart/alternative type if there are no attachments but
        #   both an html part and a plaintext part.  it will contain
        #   a single text/plain part if there is only a plaintext part,
        #   or it will contain a single text/html part if there is only
        #   an html part.
        #
        # - a text/plain type if there is only a plaintext part
        #
        # - a text/html type if there is only an html part

        if self.cc:
            base['Cc'] = ', '.join(self.cc)
            
        if self.extra_headers:
            base.update(dict(self.extra_headers))

        if self.attachments:
            base.set_content_type('multipart/mixed')
            altpart = MailBase()
            base.attach_part(altpart)
        else:
            altpart = base
            
        if body and html:
            altpart.set_content_type('multipart/alternative')
            altpart.set_body(None)
            # Per RFC2046, HTML part comes last in multipart/alternative
            altpart.attach_part(body)
            altpart.attach_part(html)
        elif body is not None:
            altpart.merge_part(body)
        elif html is not None:
            altpart.merge_part(html)

        for attachment in self.attachments:
            attachment_mailbase = attachment.to_mailbase()
            base.attach_part(attachment_mailbase)

        return to_message(base)
203244
protected void setMessage(byte[] msg) {
        try {
            readData(new DataInputStream(new ByteArrayInputStream(msg)));
        }
        catch (IOException ex) {
            logger.error("Problem setting response message - {}", ex.getMessage());
        }
    }
609730
protected BodyPart handleBinaryPart(MimePart mediaPart, String contentType) throws IOException, MessagingException {
        String contentId = mediaPart.getContentID() != null ? "(" + mediaPart.getContentID() + ")" : "";
        return new BodyPart(mediaPart.getFileName() + contentId, contentType);
    }
1043015
public void setPayloadProperties(BaseMessage message, Object msg)
   {
       MessageDataDesc messageDataDesc = message.getMessageDataDesc(null);   // Top level only
       if (messageDataDesc != null)
       {
           Map<String,Class<?>> mapPropertyNames = messageDataDesc.getPayloadPropertyNames(null);
           if (mapPropertyNames != null)
           {
               for (String strKey : mapPropertyNames.keySet())
               {
                   Class<?> classKey = mapPropertyNames.get(strKey);
                   this.setPayloadProperty(message, msg, strKey, classKey);
               }
           }
       }
       if (message.get("Version") == null)
           this.setPayloadProperty(DEFAULT_VERSION, msg, "Version", Float.class);
       this.setPayloadProperty(this.getTimeStamp(), msg, "TimeStamp", org.joda.time.DateTime.class); // Current timestamp
   }
1021773
protected BodyPart handlePart(MimePart part) throws IOException, MessagingException {
        String contentType = parseContentType(part.getContentType());

        if (part.isMimeType("multipart/*")) {
            return handleMultiPart((Multipart) part.getContent());
        } else if (part.isMimeType("text/*")) {
            return handleTextPart(part, contentType);
        } else if (part.isMimeType("image/*")) {
            return handleImageBinaryPart(part, contentType);
        } else if (part.isMimeType("application/*")) {
            return handleApplicationContentPart(part, contentType);
        } else {
            return handleBinaryPart(part, contentType);
        }
    }
1053980
public void setMessagingType( String messagingType ) {

		// Properties are injected on every modification.
		// So, we just want to track changes.

		// We only want to reconfigure the messaging client
		// when the messaging type changes.
		if( ! Objects.equals( this.messagingType, messagingType )) {
			this.messagingType = messagingType;
			this.logger.fine( "Messaging type set to " + this.messagingType );

			// Explicitly require a reconfiguration.
			reconfigure();
		}
	}
619270
def from_mime(cls, message, manager):
        
        text, html, attachments = deconstruct_multipart(message)
        subject = prepare_header(message["Subject"])
        sender = prepare_header(message["From"])
        to = prepare_header(message["To"])
        cc = prepare_header(message["Cc"])
        bcc = prepare_header(message["Bcc"])
        reply_to = prepare_header(message["Reply-To"])
        tag = getattr(message, "tag", None)
        return cls(
            manager=manager,
            From=sender,
            To=to,
            TextBody=text,
            HtmlBody=html,
            Subject=subject,
            Cc=cc,
            Bcc=bcc,
            ReplyTo=reply_to,
            Attachments=attachments,
            Tag=tag,
        )
1221533
private MimePart createHtmlMimePart() throws MessagingException {
		MimePart bodyPart = new MimeBodyPart();
		bodyPart.setContent(htmlPart, "text/html; charset=utf-8");
		return bodyPart;
	}
1185969
public void setPropertiesInMessage(JsMessage jsMsg,
                                       SIBUuid12 destinationUuid,
                                       SIBUuid12 producerConnectionUuid)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "setPropertiesInMessage",
                        new Object[] { jsMsg, destinationUuid, producerConnectionUuid });

        SIMPUtils.setGuaranteedDeliveryProperties(jsMsg,
                                                  _messageProcessor.getMessagingEngineUuid(),
                                                  null,
                                                  null,
                                                  null,
                                                  destinationUuid,
                                                  ProtocolType.PUBSUBINPUT,
                                                  GDConfig.PROTOCOL_VERSION);

        if (jsMsg.getConnectionUuid() == null)
        {
            //defect 278038:
            //The producerSession will have set this in the msgItem for pub sub 
            //destinations. However, the field may not have been set in the
            //jsMsg if the msg was not persisted before this point.
            //Since the message is going off the box, we have no choice but to set it now.
            jsMsg.setConnectionUuid(producerConnectionUuid);
        }
        //NOTE: the 'bus' field is not set in this method as it should
        //only be set once the message has been stored
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "setPropertiesInMessage");
    }
409699
private void handleOutboundMimeMessageHeader(final org.springframework.ws.soap.SoapMessage message,
                                                 final String name,
                                                 final Object value,
                                                 final boolean handleMimeHeaders) {
        if (!handleMimeHeaders) {
            return;
        }

        if (message instanceof SaajSoapMessage) {
            final SaajSoapMessage soapMsg = (SaajSoapMessage) message;
            final MimeHeaders headers = soapMsg.getSaajMessage().getMimeHeaders();
            headers.setHeader(name, value.toString());
        } else if (message instanceof AxiomSoapMessage) {
            log.warn("Unable to set mime message header '" + name + "' on AxiomSoapMessage - unsupported");
        } else {
            log.warn("Unsupported SOAP message implementation - unable to set mime message header '" + name + "'");
        }
    }