本文整理了Java中org.jivesoftware.smack.packet.Message.setSubject()
方法的一些代码示例,展示了Message.setSubject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setSubject()
方法的具体详情如下:
包路径:org.jivesoftware.smack.packet.Message
类名称:Message
方法名:setSubject
[英]Sets the subject of the message. The subject is a short description of message contents.
[中]设置消息的主题。主题是对消息内容的简短描述。
代码示例来源:origin: igniterealtime/Smack
/**
* Changes the subject within the room. As a default, only users with a role of "moderator"
* are allowed to change the subject in a room. Although some rooms may be configured to
* allow a mere participant or even a visitor to change the subject.
*
* @param subject the new room's subject to set.
* @throws XMPPErrorException if someone without appropriate privileges attempts to change the
* room subject will throw an error with code 403 (i.e. Forbidden)
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
* @throws InterruptedException
*/
public void changeSubject(final String subject) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Message message = createMessage();
message.setSubject(subject);
// Wait for an error or confirmation message back from the server.
StanzaFilter responseFilter = new AndFilter(fromRoomGroupchatFilter, new StanzaFilter() {
@Override
public boolean accept(Stanza packet) {
Message msg = (Message) packet;
return subject.equals(msg.getSubject());
}
});
StanzaCollector response = connection.createStanzaCollectorAndSend(responseFilter, message);
// Wait up to a certain number of seconds for a reply.
response.nextResultOrThrow();
}
代码示例来源:origin: igniterealtime/Smack
@Test
public void setMessageSubjectTest() throws IOException, SAXException {
final String messageSubject = "This is a test of the emergency broadcast system.";
StringBuilder controlBuilder = new StringBuilder();
controlBuilder.append("<message>")
.append("<subject>")
.append(messageSubject)
.append("</subject>")
.append("</message>");
String control = controlBuilder.toString();
Message message = getNewMessage();
message.setSubject(messageSubject);
assertEquals(messageSubject, message.getSubject());
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
代码示例来源:origin: igniterealtime/Smack
msg.setSubject("Subject of the chat");
msg.setBody("Body of the chat");
addProperty(msg, "favoriteColor", "red");
代码示例来源:origin: spring-projects/spring-integration
target.setSubject(subject);
代码示例来源:origin: spring-projects/spring-integration
@Test
public void toHeadersStandardOnly() throws XmppStringprepException {
DefaultXmppHeaderMapper mapper = new DefaultXmppHeaderMapper();
Message source = new Message(JidCreate.from("test.to"), Message.Type.headline);
source.setFrom(JidCreate.from("test.from"));
source.setSubject("test.subject");
source.setThread("test.thread");
JivePropertiesManager.addProperty(source, "userDefined1", "foo");
JivePropertiesManager.addProperty(source, "userDefined2", "bar");
Map<String, Object> headers = mapper.toHeadersFromRequest(source);
assertEquals("test.to", headers.get(XmppHeaders.TO).toString());
assertEquals("test.from", headers.get(XmppHeaders.FROM).toString());
assertEquals("test.subject", headers.get(XmppHeaders.SUBJECT));
assertEquals("test.thread", headers.get(XmppHeaders.THREAD));
assertEquals(Message.Type.headline, headers.get(XmppHeaders.TYPE));
assertNull(headers.get("userDefined1"));
assertNull(headers.get("userDefined2"));
}
代码示例来源:origin: spring-projects/spring-integration
@Test
public void toHeadersUserDefinedOnly() throws XmppStringprepException {
DefaultXmppHeaderMapper mapper = new DefaultXmppHeaderMapper();
mapper.setReplyHeaderNames("userDefined*");
Message source = new Message(JidCreate.from("test.to"), Message.Type.headline);
source.setFrom(JidCreate.from("test.from"));
source.setSubject("test.subject");
source.setThread("test.thread");
JivePropertiesManager.addProperty(source, "userDefined1", "foo");
JivePropertiesManager.addProperty(source, "userDefined2", "bar");
Map<String, Object> headers = mapper.toHeadersFromReply(source);
assertNull(headers.get(XmppHeaders.TO));
assertNull(headers.get(XmppHeaders.FROM));
assertNull(headers.get(XmppHeaders.SUBJECT));
assertNull(headers.get(XmppHeaders.THREAD));
assertNull(headers.get(XmppHeaders.TYPE));
assertEquals("foo", headers.get("userDefined1"));
assertEquals("bar", headers.get("userDefined2"));
}
代码示例来源:origin: spring-projects/spring-integration-extensions
target.setSubject(subject);
代码示例来源:origin: org.mobicents.resources/mobicents-slee-ra-xmpp-library
message.setSubject(subject);
message.setBody(body);
message.setThread(thread);
代码示例来源:origin: CESNET/perun
message.setSubject(messageDto.getSubject());
message.setBody(messageDto.getMessageToSend());
message.setType(Message.Type.headline);
代码示例来源:origin: spring-projects/spring-integration-extensions
@Test
public void toHeadersStandardOnly() {
DefaultXmppHeaderMapper mapper = new DefaultXmppHeaderMapper();
Message source = new Message("test.to", Message.Type.headline);
source.setFrom("test.from");
source.setSubject("test.subject");
source.setThread("test.thread");
JivePropertiesManager.addProperty(source, "userDefined1", "foo");
JivePropertiesManager.addProperty(source, "userDefined2", "bar");
Map<String, Object> headers = mapper.toHeadersFromRequest(source);
assertEquals("test.to", headers.get(XmppHeaders.TO));
assertEquals("test.from", headers.get(XmppHeaders.FROM));
assertEquals("test.subject", headers.get(XmppHeaders.SUBJECT));
assertEquals("test.thread", headers.get(XmppHeaders.THREAD));
assertEquals(Message.Type.headline, headers.get(XmppHeaders.TYPE));
assertNull(headers.get("userDefined1"));
assertNull(headers.get("userDefined2"));
}
代码示例来源:origin: spring-projects/spring-integration-extensions
@Test
public void toHeadersUserDefinedOnly() {
DefaultXmppHeaderMapper mapper = new DefaultXmppHeaderMapper();
mapper.setReplyHeaderNames(new String[] { "userDefined*" });
Message source = new Message("test.to", Message.Type.headline);
source.setFrom("test.from");
source.setSubject("test.subject");
source.setThread("test.thread");
JivePropertiesManager.addProperty(source, "userDefined1", "foo");
JivePropertiesManager.addProperty(source, "userDefined2", "bar");
Map<String, Object> headers = mapper.toHeadersFromReply(source);
assertNull(headers.get(XmppHeaders.TO));
assertNull(headers.get(XmppHeaders.FROM));
assertNull(headers.get(XmppHeaders.SUBJECT));
assertNull(headers.get(XmppHeaders.THREAD));
assertNull(headers.get(XmppHeaders.TYPE));
assertEquals("foo", headers.get("userDefined1"));
assertEquals("bar", headers.get("userDefined2"));
}
代码示例来源:origin: org.mule.transports/mule-transport-xmpp
result.setSubject((String) muleMessage.getOutboundProperty(propertyName));
代码示例来源:origin: org.mobicents.resources/mobicents-slee-ra-xmpp-library
message.setSubject(subject);
代码示例来源:origin: org.littleshoot/smack-xmpp-3-2-2
message.setSubject(subject);
代码示例来源:origin: org.igniterealtime.smack/smackx
message.setSubject(subject);
代码示例来源:origin: tiandawu/IotXmpp
message.setSubject(subject);
内容来源于网络,如有侵权,请联系作者删除!