Java Reference
In-Depth Information
you an instant message you need to add the application to your friend list in
Google Talk. In the web interface for Google Talk, which is nested inside the Gmail
interface, we've added apressxmpp@appspot.com as illustrated in Figure 8-10.
Figure 8-10. Application ID added to Google Talk
You can see that the application appears to be online. You can send it messages, but
it will not respond. You're just going to be looking at sending XMPP messages. If
you'd like to enable your application to receive XMPP messages, reference the
online documentation at http://code.google.com/appengine. Create a servlet called
XMPPServlet.java in the same Eclipse project that you've been using throughout
this chapter. Copy the code from Listing 8-13 into the new servlet.
Listing 8-13. MailServlet.java
package com.kyleroche.xmpp;
import java.io.IOException;
import javax.servlet.http.*;
import com.google.appengine.api.xmpp.JID;
import com.google.appengine.api.xmpp.Message;
import com.google.appengine.api.xmpp.MessageBuilder;
import com.google.appengine.api.xmpp.SendResponse;
import com.google.appengine.api.xmpp.XMPPService;
import com.google.appengine.api.xmpp.XMPPServiceFactory;
@SuppressWarnings("serial")
public class XMPPServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
JID jid = new JID("put your gmail account here");
 
Search WWH ::




Custom Search