Package com.google.appengine.api.xmpp

Examples of com.google.appengine.api.xmpp.JID


     * @param jabberIdTo the Jabber ID to get the presence from
     * @param jabberIdFrom the Jabber ID to use to send the presence request
     * @return the presence information
     */
    public static Presence getPresence(XMPPService xmppService, String jabberIdTo, String jabberIdFrom) {
        return xmppService.getPresence(new JID(jabberIdTo), new JID(jabberIdFrom));
    }
View Full Code Here


        String value = request.getParameter("value");

        @SuppressWarnings("rawtypes") Map formData = parseXmppFormData(request);

        return new PresenceBuilder()
                .withFromJid(new JID((String) formData.get("from")))
                .withToJid(new JID((String) formData.get("to")))
                .withPresenceType(PresenceType.valueOf(value.toUpperCase()))
                .withPresenceShow("available".equals(value) ? PresenceShow.NONE : null)
                .build();
    }
View Full Code Here

        String value = request.getParameter("value");

        @SuppressWarnings("rawtypes") Map formData = parseXmppFormData(request);

        return new SubscriptionBuilder()
                .withFromJid(new JID((String) formData.get("from")))
                .withToJid(new JID((String) formData.get("to")))
                .withSubscriptionType(SubscriptionType.valueOf(value.toUpperCase()))
                .build();
    }
View Full Code Here

  private static final Logger log = Logger.getLogger(PushwishToGTalk.class.getName());
  private JID tojid;
  private XMPPService xmpp = XMPPServiceFactory.getXMPPService();
 
  public PushwishToGTalk(String user) {
    tojid = new JID(user);
  }
View Full Code Here

  public void doPost(HttpServletRequest req, HttpServletResponse res)
      throws IOException {
    XMPPService xmpp = XMPPServiceFactory.getXMPPService();
    Message message = xmpp.parseMessage(req);
    JID fromJid = message.getFromJid();
    String body = message.getBody();
    Message msg;

    try {
      URL url = new URL("http://d3viewer.appspot.com/comment/");
      HttpURLConnection connection = (HttpURLConnection) url
          .openConnection();
      connection.setDoOutput(true);
      connection.setRequestMethod("POST");
      String security = URLEncoder.encode(fromJid.getId() + " says: " + body,
          "UTF-8");
      OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
      writer.write("message=" + security);
      writer.close();
View Full Code Here

    @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);
View Full Code Here

          throws IOException {
        XMPPService xmpp = XMPPServiceFactory.getXMPPService();

        // receive message
        Message message = xmpp.parseMessage(req);
        JID from = message.getFromJid();
        JID[] recipients = message.getRecipientJids();
        JID to = (recipients.length > 0) ? recipients[0] : null;
       
        String body = message.getBody();
    if (body != null && body.startsWith("{") || body.trim().startsWith("{")) {
      // the body contains a JSON object
      ObjectNode json = null;
      try {
        String agentUrl = "xmpp:" + to.getId();
        String agentId = xmppService != null ? xmppService.getAgentId(agentUrl) : null;
       
        json = JOM.getInstance().readValue(body, ObjectNode.class);
        if (isResponse(json)) {
          // TODO: handle response
View Full Code Here

          throws IOException {
        XMPPService xmpp = XMPPServiceFactory.getXMPPService();

        // receive message
        Message message = xmpp.parseMessage(req);
        JID from = message.getFromJid();
        JID[] recipients = message.getRecipientJids();
        JID to = (recipients.length > 0) ? recipients[0] : null;
       
        String body = message.getBody();
    if (body != null && body.startsWith("{") || body.trim().startsWith("{")) {
      // the body contains a JSON object
      ObjectNode json = null;
      try {
        String agentUrl = "xmpp:" + to.getId();
        String agentId = xmppService != null ? xmppService.getAgentId(agentUrl) : null;
       
        json = JOM.getInstance().readValue(body, ObjectNode.class);
        if (isResponse(json)) {
          // TODO: handle response
View Full Code Here

      throws IOException {
    XMPPService xmpp = XMPPServiceFactory.getXMPPService();
   
    // receive message
    Message message = xmpp.parseMessage(req);
    JID from = message.getFromJid();
    JID[] recipients = message.getRecipientJids();
    JID to = (recipients.length > 0) ? recipients[0] : null;
   
    String body = message.getBody();
    if (body != null && body.startsWith("{") || body.trim().startsWith("{")) {
      // the body contains a JSON object
      try {
        String agentUrl = "xmpp:" + to.getId();
        String agentId = xmppService != null ? xmppService
            .getAgentId(new URI(agentUrl)) : null;
       
        logger.info("request agentUrl =" + agentUrl + ", agentId="
            + agentId + " request=" + body + ", sender="
View Full Code Here

TOP

Related Classes of com.google.appengine.api.xmpp.JID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.