当前位置: 首页>>代码示例>>Java>>正文


Java SendResponse类代码示例

本文整理汇总了Java中com.google.appengine.api.xmpp.SendResponse的典型用法代码示例。如果您正苦于以下问题:Java SendResponse类的具体用法?Java SendResponse怎么用?Java SendResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SendResponse类属于com.google.appengine.api.xmpp包,在下文中一共展示了SendResponse类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendXmppMessage

import com.google.appengine.api.xmpp.SendResponse; //导入依赖的package包/类
public static boolean sendXmppMessage(String p_jabberId, ChatMessage p_chatMessage)
{
  boolean messageSent = false;
  if( p_jabberId != null )
  {
    JID jid = new JID(p_jabberId);
    String msgBody = "[" + p_chatMessage.getFromPseudo() + "] " + p_chatMessage.getText();
    Message msg = new MessageBuilder()
                      .withRecipientJids(jid)
                      .withBody(msgBody)
                      .build();
            
    XMPPService xmpp = XMPPServiceFactory.getXMPPService();
    SendResponse status = xmpp.sendMessage(msg);
    messageSent = (status.getStatusMap().get(jid) == SendResponse.Status.SUCCESS);
  }
  return messageSent;
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:19,代码来源:XMPPMessageServlet.java

示例2: testXmppSendMessageAndReceiveDefaultJid

import com.google.appengine.api.xmpp.SendResponse; //导入依赖的package包/类
@Test
public void testXmppSendMessageAndReceiveDefaultJid() {
    assumeEnvironment(Environment.APPSPOT);

    JID fromJID = new JID(appId + "@" + xmppServer);
    // We're sending messages to ourselves, so toJID and fromJID are the same.
    @SuppressWarnings("UnnecessaryLocalVariable")
    JID toJID = fromJID;

    MessageBuilder builder = new MessageBuilder();
    builder.withMessageType(MessageType.valueOf("CHAT"));
    builder.withFromJid(fromJID);
    builder.withRecipientJids(toJID);
    String testBody = TEST_BODY + System.currentTimeMillis();
    builder.withBody(testBody);
    builder.asXml(false);
    Message msg = builder.build();

    SendResponse response = xmppService.sendMessage(msg);
    assertNotNull("expected a response", response);
    assertEquals(1, response.getStatusMap().size());
    assertEquals(SendResponse.Status.SUCCESS, response.getStatusMap().get(toJID));

    verifyChatReceivedWithBody(testBody);
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-tck,代码行数:26,代码来源:SimpleXmppTest.java

示例3: processMessage

import com.google.appengine.api.xmpp.SendResponse; //导入依赖的package包/类
public void processMessage(Message message, HttpServletResponse res) throws IOException {
  JID fromId = message.getFromJid();
  Presence presence = xmppService.getPresence(fromId);
  String presenceString = presence.isAvailable() ? "" : "not ";
  SendResponse response = xmppService.sendMessage(
      new MessageBuilder().
      withBody(message.getBody() + " (you are " + presenceString + "available)").
      withRecipientJids(fromId).
      build());

  for (Map.Entry<JID, SendResponse.Status> entry :
      response.getStatusMap().entrySet()) {
    res.getWriter().println(entry.getKey() + "," + entry.getValue() + "<br>");
  }

  res.getWriter().println("processed");
}
 
开发者ID:dougkoellmer,项目名称:swarm,代码行数:18,代码来源:HelloXmpp.java


注:本文中的com.google.appengine.api.xmpp.SendResponse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。