本文整理了Java中org.jivesoftware.smack.packet.Message.addBody()
方法的一些代码示例,展示了Message.addBody()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.addBody()
方法的具体详情如下:
包路径:org.jivesoftware.smack.packet.Message
类名称:Message
方法名:addBody
[英]Adds a body with a corresponding language.
[中]
代码示例来源:origin: igniterealtime/Smack
/**
* Sets the body of the message. The body is the main message contents.
*
* @param body the body of the message.
*/
public void setBody(String body) {
if (body == null) {
removeBody(""); // use empty string because #removeBody(null) is ambiguous
return;
}
addBody(null, body);
}
代码示例来源:origin: igniterealtime/Smack
@Test(expected = NullPointerException.class)
public void setNullMessageBodyTest() {
Message message = getNewMessage();
message.addBody(null, null);
}
代码示例来源:origin: igniterealtime/Smack
message.addBody(null, messageBody1);
message.addBody(lang2, messageBody2);
message.addBody(lang3, messageBody3);
XmlUnitUtils.assertSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE));
代码示例来源:origin: igniterealtime/Smack
@Test
public void removeMessageBodyTest() {
Message message = getNewMessage();
message.setBody("test");
assertTrue(message.getBodies().size() == 1);
message.setBody(null);
assertTrue(message.getBodies().size() == 0);
assertFalse(message.removeBody("sp"));
Message.Body body = message.addBody("es", "test");
assertTrue(message.getBodies().size() == 1);
message.removeBody(body);
assertTrue(message.getBodies().size() == 0);
}
代码示例来源:origin: stackoverflow.com
if(msg.getBody().toString().equalsIgnoreCase("RecivedByReciver")){
//do what you want after get notify.
}else{
//do what you want if not delevery report message.
Message message=new Message(ConnectionManager.parseBareAddress(msg.getFrom()),Message.Type.chat);
message.addBody(null,"RecivedByReciver");
Connection().sendPacket(message);
}
代码示例来源:origin: org.igniterealtime.smack/smack
/**
* Sets the body of the message. The body is the main message contents.
*
* @param body the body of the message.
*/
public void setBody(String body) {
if (body == null) {
removeBody(""); // use empty string because #removeBody(null) is ambiguous
return;
}
addBody(null, body);
}
代码示例来源:origin: tiandawu/IotXmpp
/**
* Sets the body of the message. The body is the main message contents.
*
* @param body the body of the message.
*/
public void setBody(String body) {
if (body == null) {
removeBody(""); // use empty string because #removeBody(null) is ambiguous
return;
}
addBody(null, body);
}
代码示例来源:origin: org.igniterealtime.smack/smack-core
/**
* Sets the body of the message. The body is the main message contents.
*
* @param body the body of the message.
*/
public void setBody(String body) {
if (body == null) {
removeBody(""); // use empty string because #removeBody(null) is ambiguous
return;
}
addBody(null, body);
}
代码示例来源:origin: org.littleshoot/smack-xmpp-3-2-2
/**
* Sets the body of the message. The body is the main message contents.
*
* @param body the body of the message.
*/
public void setBody(String body) {
if (body == null) {
removeBody(""); // use empty string because #removeBody(null) is ambiguous
return;
}
addBody(null, body);
}
代码示例来源:origin: Blazemeter/jmeter-bzm-plugins
private void sendResponseMessage(Message inMsg) {
Message outMsg = new Message(inMsg.getFrom());
outMsg.setType(inMsg.getType());
outMsg.addBody("", inMsg.getBody() + "\r\n" + System.currentTimeMillis() + "@" + RESPONSE_MARKER);
log.debug("Responding to message: " + outMsg.toXML());
try {
conn.sendPacket(outMsg);
} catch (SmackException e) {
log.error("Failed to send response", e);
}
}
代码示例来源:origin: tiandawu/IotXmpp
message.addBody(xmlLang, body);
代码示例来源:origin: org.igniterealtime.smack/smack
message.addBody(xmlLang, body);
代码示例来源:origin: org.littleshoot/smack-xmpp-3-2-2
message.addBody(xmlLang, body);
代码示例来源:origin: Blazemeter/jmeter-bzm-plugins
@Override
public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception {
// sending message
String recipient = sampler.getPropertyAsString(RECIPIENT);
String body = sampler.getPropertyAsString(BODY);
boolean wait_response = sampler.getPropertyAsBoolean(WAIT_RESPONSE);
if (wait_response) {
body += "\r\n" + System.currentTimeMillis() + "@" + NEED_RESPONSE_MARKER;
}
Message msg = new Message(recipient);
msg.setType(Message.Type.fromString(sampler.getPropertyAsString(TYPE, Message.Type.normal.toString())));
msg.addBody("", body);
res.setSamplerData(msg.toXML().toString());
sampler.getXMPPConnection().sendPacket(msg);
res.setSamplerData(msg.toXML().toString()); // second time to reflect the changes made to packet by conn
if (wait_response) {
return waitResponse(res, recipient);
}
return res;
}
内容来源于网络,如有侵权,请联系作者删除!