Retrieves a quick reply payload from an envelope. It never returns null.

@param envelope
the message envelope.
@return the text message if found or an empty String otherwise. It never
returns null.
487302
protected String safeGetQuickReplyPayload(MessageEnvelope envelope) {
		if (envelope != null && envelope.getMessage() != null
				&& envelope.getMessage().getQuickReply() != null
				&& envelope.getMessage().getQuickReply().getPayload() != null) {
			return envelope.getMessage().getQuickReply().getPayload();
		}

		return "";
	}
461449
public Object sendMessageAndGetReply() throws RemoteException
    {
        try {
            URL url = this.getProxyURL();
            ServletMessage servlet = new ServletMessage(url);
            InputStream in = servlet.sendMessage(m_properties);
            InputStreamReader reader = new InputStreamReader(in);
            BufferedReader buffReader = new BufferedReader(reader);
            String string = "";
            while (true)
            {
                String str = buffReader.readLine();
                if ((str == null) || (str.length() == 0))
                    break;
                if (string.length() > 0)
                    string += "\n";
                string += str;
            }
System.out.println("ProxyTransport.sendandreceive() reply: " + string);
            return string;
        } catch (MalformedURLException ex)  {
            ex.printStackTrace();
        } catch (IOException ex)  {
            ex.printStackTrace();
        }
        return null;
    }
1158650
protected String getString(Exchange exchange, Message message, String name) {
        Object value = getObject(exchange, message, name);
        if (value instanceof String) {
            return (String)value;
        } else if (value != null) {
            return String.valueOf(value);
        }
        return null;
    }
25320
@Override
    public String getMessage() {
        String message = super.getMessage();

        if (message == null) {
            message = "";
        }

        if (hexdump != null) {
            return message + (message.length() > 0 ? " " : "") + "(Hexdump: "
                    + hexdump + ')';
        }

        return message;
    }
230568
private MessageEntry findMessageEntry(ApptentiveMessage message) {
		Assert.assertNotNull(message);
		return message != null ? findMessageEntry(message.getNonce()) : null;
	}
585796
protected void processEnvelope(Envelope envelope) {

        ActorScope scope = envelope.getScope();

        // Log.d("ACTOR_TRACE", "processEnvelope: " + envelope.getMessage() + " -> " + scope.getPath());

        if (actorSystem.getTraceInterface() != null) {
            actorSystem.getTraceInterface().onEnvelopeDelivered(envelope);
        }

        long start = ActorTime.currentTime();
        boolean isDisconnected = false;

        if (scope.getActor() == null) {
            if (envelope.getMessage() == PoisonPill.INSTANCE) {
                // Not creating actor for PoisonPill
                return;
            }
            try {
                Actor actor = scope.getProps().create();
                CurrentActor.setCurrentActor(actor);
                actor.initActor(scope.getUuid(), scope.getPath(), new ActorContext(scope), scope.getMailbox());
                for (ActorExtension e : actor.getExtensions()) {
                    e.preStart();
                }
                actor.preStart();
                scope.onActorCreated(actor);
            } catch (Exception e) {
                e.printStackTrace();
                if (envelope.getSender() != null) {
                    envelope.getSender().send(new DeadLetter("Unable to create actor"));
                }
                return;
            }
        }

        try {
            if (envelope.getMessage() == StartActor.INSTANCE) {
                // Already created actor
                return;
            } else if (envelope.getMessage() == Ping.INSTANCE) {
                // No op
                return;
            } else if (envelope.getMessage() == PoisonPill.INSTANCE) {
                isDisconnected = true;
                for (ActorExtension e : scope.getActor().getExtensions()) {
                    e.postStop();
                }
                scope.getActor().postStop();
                scope.onActorDie();
                for (Envelope e : scope.getMailbox().allEnvelopes()) {
                    if (e.getSender() != null) {
                        e.getSender().send(new DeadLetter(e.getMessage()));
                    }
                }
                scope.getMailbox().clear();
                synchronized (LOCK) {
                    scopes.remove(scope.getPath());
                    endpoints.remove(scope.getPath());
                    dispatcher.getQueue().disconnectMailbox(scope.getMailbox());
                }
            } else {
                CurrentActor.setCurrentActor(scope.getActor());
                scope.setSender(envelope.getSender());
                for (ActorExtension e : scope.getActor().getExtensions()) {
                    if (e.onReceive(envelope.getMessage())) {
                        return;
                    }
                }
                scope.getActor().onReceive(envelope.getMessage());
            }
        } catch (Exception e) {
            if (actorSystem.getTraceInterface() != null) {
                actorSystem.getTraceInterface().onActorDie(scope.getActorRef(), e);
            }
            scope.onActorDie();
            isDisconnected = true;
            synchronized (LOCK) {
                scopes.remove(scope.getPath());
                endpoints.remove(scope.getPath());
                dispatcher.getQueue().disconnectMailbox(scope.getMailbox());
            }
        } finally {
            if (actorSystem.getTraceInterface() != null) {
                actorSystem.getTraceInterface().onEnvelopeProcessed(envelope, ActorTime.currentTime() - start);
            }
            CurrentActor.setCurrentActor(null);
            if (!isDisconnected) {
                dispatcher.getQueue().unlockMailbox(envelope.getMailbox());
            }
        }
    }
976786
public void request(
            final Message message,
            final OperationResult<Message, Exception> onResponse) {

        if (message == null) {
            throw new IllegalArgumentException("message cannot be null");
        }
        if (message.getMessageId() != null) {
            throw new IllegalArgumentException("message.getMessageId() should be null");
        }
        if (message.getReplyTo() != null) {
            throw new IllegalArgumentException("message.getReplyTo() should be null");
        }
        message.setMessageId("request" + UnsignedLong.valueOf(this.requestId.incrementAndGet()).toString());
        message.setReplyTo(this.replyTo);

        this.inflightRequests.put(message.getMessageId(), onResponse);

        sendLink.delivery(UUID.randomUUID().toString().replace("-", StringUtil.EMPTY).getBytes(UTF_8));
        final int payloadSize = AmqpUtil.getDataSerializedSize(message) + 512; // need buffer for headers

        final byte[] bytes = new byte[payloadSize];
        final int encodedSize = message.encode(bytes, 0, payloadSize);

        receiveLink.flow(1);
        sendLink.send(bytes, 0, encodedSize);
        sendLink.advance();
    }
927998
public void sendQuickReplyPayload(String payload) {
		MessageEnvelope envelope = new MessageEnvelope();
		QuickReply quickReply = new QuickReply("Sample", payload);

		ReceivedMessage message = new ReceivedMessage();
		message.setQuickReply(quickReply);
		envelope.setMessage(message);
		envelope.setSender(new User(facebookMockId));

		System.out.println("Sending quick reply: [" + message + "] as user : ["
				+ facebookMockId + "].");
		forward(envelope);
		System.out.println("Sent!");
	}
19572
private void validateText(String receivedMessagePayload, String controlMessagePayload) {
        if (!StringUtils.hasText(controlMessagePayload)) {
            log.debug("Skip message payload validation as no control message was defined");
            return;
        } else {
            Assert.isTrue(StringUtils.hasText(receivedMessagePayload), "Validation failed - " +
                    "expected message contents, but received empty message!");
        }

        if (!receivedMessagePayload.equals(controlMessagePayload)) {
            if (StringUtils.trimAllWhitespace(receivedMessagePayload).equals(StringUtils.trimAllWhitespace(controlMessagePayload))) {
                throw new ValidationException("Text values not equal (only whitespaces!), expected '" + controlMessagePayload + "' " +
                        "but was '" + receivedMessagePayload + "'");
            } else {
                throw new ValidationException("Text values not equal, expected '" + controlMessagePayload + "' " +
                        "but was '" + receivedMessagePayload + "'");
            }
        }
    }
1093453
@Override
	public FbBotMillResponse createResponse(MessageEnvelope envelope) {
		FbBotMillResponse response = null;

		switch (attachmentType) {
		case FILE:
			response = ReplyFactory.addFileAttachment(url).build(envelope);
			break;
		case IMAGE:
			response = ReplyFactory.addImageAttachment(url).build(envelope);
			break;
		case AUDIO:
			response = ReplyFactory.addAudioAttachment(url).build(envelope);
			break;
		case VIDEO:
			response = ReplyFactory.addVideoAttachment(url).build(envelope);
			break;
		default:
			String message = "Illegal attachment of type [ " + attachmentType.name() + " ] for AttachmentAutoReply";
			logger.error(message);
			throw new BotMillIllegalAttachmentException(message);
		}
		return response;
	}
280125
public static <Payload> Message<Payload> create(Payload payload) {
    return new Message<>(payload, HashTreePMap.empty());
  }
641040
public function respondWithMessageAndPayload($payload = null, $message = "Ok")
    {
        $data = $this->getResponseStructure(true, $payload, $message);
        $reponse = $this->respond($data);
        return $reponse;
    }
769651
public static String parseMessagePayload(Element payloadElement) {
        if (payloadElement == null) {
            return "";
        }
        
        try {
            Document payload = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
            payload.appendChild(payload.importNode(payloadElement, true));

            String payloadData = XMLUtils.serialize(payload);
            // temporary quickfix for unwanted testcase namespace in target payload
            payloadData = payloadData.replaceAll(" xmlns=\\\"http://www.citrusframework.org/schema/testcase\\\"", "");
            return payloadData.trim();
        } catch (DOMException e) {
            throw new CitrusRuntimeException("Error while constructing message payload", e);
        } catch (ParserConfigurationException e) {
            throw new CitrusRuntimeException("Error while constructing message payload", e);
        }
    }
1306171
public byte[] sendWithResult(final byte[] message) {
        synchronized (webSocketHandler.getNotifyResultObject()) {
            webSocketHandler.sendMessage(message);

            try {
                webSocketHandler.getNotifyResultObject().wait(TimeUnit.SECONDS.toMillis(ANSWER_TIMEOUT));
            }
            catch (InterruptedException e) {
                return null;
            }

            return webSocketHandler.getResultBytes();
        }
    }
718991
public java.util.Map<String, java.util.List<String>> getPayload() {
        return payload;
    }
880305
private String getPayLoad(Key key, Application app) {
        if (app == null) {
            return EMPTY_PAYLOAD;
        }

        EncoderWrapper encoderWrapper = serverCodecs.getEncoder(key.getType(), key.getEurekaAccept());
        try {
            return encoderWrapper.encode(app);
        } catch (Exception e) {
            logger.error("Failed to encode the payload for application {}", app.getName(), e);
            return "";
        }
    }
532025
public boolean process(MessageEnvelope envelope) {
		if (this.event == null) {
			return false;
		}

		boolean triggered = this.event.verifyEventCondition(envelope);
		if (triggered) {
			beforeReply(envelope);
			if (this.reply != null) {
				this.reply.reply(envelope);
			}
			afterReply(envelope);
		}
		return triggered;
	}