public MuleMessage(Object message, UMOMessageAdapter previous) { if (message instanceof UMOMessageAdapter) { adapter = (UMOMessageAdapter) message; } else { adapter = new DefaultMessageAdapter(message, previous); } if (previous.getExceptionPayload() != null) { setExceptionPayload(previous.getExceptionPayload()); } setEncoding(previous.getEncoding()); if (previous.getAttachmentNames().size() > 0) { Set attNames = adapter.getAttachmentNames(); synchronized (attNames) { for (Iterator iterator = attNames.iterator(); iterator.hasNext(); ) { String s = (String) iterator.next(); try { addAttachment(s, adapter.getAttachment(s)); } catch (Exception e) { throw new MuleRuntimeException(new Message(Messages.FAILED_TO_READ_ATTACHMENT_X, s), e); } } } } }
/** * Gets the encoding for the current message. For potocols that send encoding Information with the * message, this method should be overriden to expose the transport encoding, otherwise the * default encoding in the Mule configuration will be used * * @return the encoding for this message. This method must never return null */ public String getEncoding() { return adapter.getEncoding(); }