From f222994d9ab13fdd570fa10c5c99be14a158085c Mon Sep 17 00:00:00 2001 From: Mete Atamel <atamel@google.com> Date: Mon, 25 Apr 2016 13:21:32 +0100 Subject: [PATCH 1/3] Added samples showcasing XMPP Added a number of Servlet based examples for XMPP --- appengine/xmpp/README.md | 20 ++++++ appengine/xmpp/pom.xml | 72 +++++++++++++++++++ .../example/appengine/xmpp/ErrorServlet.java | 45 ++++++++++++ .../xmpp/MessageReceiverServlet.java | 47 ++++++++++++ .../appengine/xmpp/MessageSenderServlet.java | 58 +++++++++++++++ .../appengine/xmpp/PresenceServlet.java | 51 +++++++++++++ .../appengine/xmpp/SubscriptionServlet.java | 47 ++++++++++++ .../src/main/webapp/WEB-INF/appengine-web.xml | 28 ++++++++ .../xmpp/src/main/webapp/WEB-INF/web.xml | 65 +++++++++++++++++ 9 files changed, 433 insertions(+) create mode 100644 appengine/xmpp/README.md create mode 100644 appengine/xmpp/pom.xml create mode 100644 appengine/xmpp/src/main/java/com/example/appengine/xmpp/ErrorServlet.java create mode 100644 appengine/xmpp/src/main/java/com/example/appengine/xmpp/MessageReceiverServlet.java create mode 100644 appengine/xmpp/src/main/java/com/example/appengine/xmpp/MessageSenderServlet.java create mode 100644 appengine/xmpp/src/main/java/com/example/appengine/xmpp/PresenceServlet.java create mode 100644 appengine/xmpp/src/main/java/com/example/appengine/xmpp/SubscriptionServlet.java create mode 100644 appengine/xmpp/src/main/webapp/WEB-INF/appengine-web.xml create mode 100644 appengine/xmpp/src/main/webapp/WEB-INF/web.xml diff --git a/appengine/xmpp/README.md b/appengine/xmpp/README.md new file mode 100644 index 00000000000..7ca936b5f0c --- /dev/null +++ b/appengine/xmpp/README.md @@ -0,0 +1,20 @@ +# Google App Engine Standard Environment XMPP Java API Overview + +This sample demonstrates how to use XMPP Java API on Google App Engine. + +See the [Google App Engine standard environment documentation][ae-docs] for more +detailed instructions. + +[ae-docs]: https://cloud.google.com/appengine/docs/java/ + +## Setup +1. Update the `<application>` tag in `src/main/webapp/WEB-INF/appengine-web.xml` + with your project name. +1. Update the `<version>` tag in `src/main/webapp/WEB-INF/appengine-web.xml` + with your version name. + +## Running locally + $ mvn appengine:devserver + +## Deploying + $ mvn appengine:update diff --git a/appengine/xmpp/pom.xml b/appengine/xmpp/pom.xml new file mode 100644 index 00000000000..766688c937c --- /dev/null +++ b/appengine/xmpp/pom.xml @@ -0,0 +1,72 @@ +<!-- +Copyright 2015 Google Inc. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <packaging>war</packaging> + <version>1.0-SNAPSHOT</version> + <groupId>com.example.appengine</groupId> + <artifactId>appengine-helloworld</artifactId> + <parent> + <groupId>com.google.cloud</groupId> + <artifactId>doc-samples</artifactId> + <version>1.0.0</version> + <relativePath>../..</relativePath> + </parent> + <dependencies> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <type>jar</type> + <scope>provided</scope> + </dependency> + + <!-- [START dependencies] --> + <!-- Parent POM defines ${appengine.sdk.version} (updates frequently). --> + <dependency> + <groupId>com.google.appengine</groupId> + <artifactId>appengine-api-1.0-sdk</artifactId> + </dependency> + <!-- [END dependencies] --> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>19.0</version> + </dependency> + + </dependencies> + <build> + <!-- for hot reload of the web application --> + <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <version>3.3</version> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.7</source> + <target>1.7</target> + </configuration> + </plugin> + <!-- Parent POM defines ${appengine.sdk.version} (updates frequently). --> + <plugin> + <groupId>com.google.appengine</groupId> + <artifactId>appengine-maven-plugin</artifactId> + <version>${appengine.sdk.version}</version> + </plugin> + </plugins> + </build> +</project> diff --git a/appengine/xmpp/src/main/java/com/example/appengine/xmpp/ErrorServlet.java b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/ErrorServlet.java new file mode 100644 index 00000000000..49e96ffbf0c --- /dev/null +++ b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/ErrorServlet.java @@ -0,0 +1,45 @@ +/** + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.appengine.xmpp; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.logging.Logger; +import javax.servlet.ServletInputStream; +import javax.servlet.http.*; +import com.google.common.io.ByteStreams; + +// [START example] +@SuppressWarnings("serial") +public class ErrorServlet extends HttpServlet { + + private static final Logger log = Logger.getLogger(ErrorServlet.class.getName()); + + @Override + public void doPost(HttpServletRequest req, HttpServletResponse res) + throws IOException { + + // Parse the POST data, which is sent as a MIME stream containing the stanza. + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ServletInputStream inputStream = req.getInputStream(); + ByteStreams.copy(inputStream, baos); + + // Log the error + log.warning("Error stanza received: " + baos.toString()); + } +} +// [END example] diff --git a/appengine/xmpp/src/main/java/com/example/appengine/xmpp/MessageReceiverServlet.java b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/MessageReceiverServlet.java new file mode 100644 index 00000000000..2115c5cca7b --- /dev/null +++ b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/MessageReceiverServlet.java @@ -0,0 +1,47 @@ +/** + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.appengine.xmpp; + +import java.io.IOException; +import java.util.logging.Logger; +import javax.servlet.http.*; +import com.google.appengine.api.xmpp.JID; +import com.google.appengine.api.xmpp.Message; +import com.google.appengine.api.xmpp.XMPPService; +import com.google.appengine.api.xmpp.XMPPServiceFactory; + +// [START example] +@SuppressWarnings("serial") +public class MessageReceiverServlet extends HttpServlet { + + private static final Logger log = Logger.getLogger(MessageReceiverServlet.class.getName()); + + @Override + 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(); + + log.info("Received a message with id: " + fromJid + " and body: " + body); + // ... + } +} +// [END example] diff --git a/appengine/xmpp/src/main/java/com/example/appengine/xmpp/MessageSenderServlet.java b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/MessageSenderServlet.java new file mode 100644 index 00000000000..4264c5190ef --- /dev/null +++ b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/MessageSenderServlet.java @@ -0,0 +1,58 @@ +/** + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.appengine.xmpp; + +import java.io.IOException; +import java.util.logging.Logger; +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; + +// [START example] +@SuppressWarnings("serial") +public class MessageSenderServlet extends HttpServlet { + + private static final Logger log = Logger.getLogger(MessageSenderServlet.class.getName()); + + @Override + public void doGet(HttpServletRequest req, HttpServletResponse res) + throws IOException { + + JID jid = new JID("example@gmail.com"); + String msgBody = "Someone has sent you a gift on Example.com. To view: http://example.com/gifts/"; + Message msg = new MessageBuilder() + .withRecipientJids(jid) + .withBody(msgBody) + .build(); + + boolean messageSent = false; + XMPPService xmpp = XMPPServiceFactory.getXMPPService(); + SendResponse status = xmpp.sendMessage(msg); + messageSent = (status.getStatusMap().get(jid) == SendResponse.Status.SUCCESS); + + log.info("Message sent? " + messageSent); + + if (!messageSent) { + // Send an email message instead... + } + } +} +// [END example] diff --git a/appengine/xmpp/src/main/java/com/example/appengine/xmpp/PresenceServlet.java b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/PresenceServlet.java new file mode 100644 index 00000000000..edc1f81cffe --- /dev/null +++ b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/PresenceServlet.java @@ -0,0 +1,51 @@ +/** + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.appengine.xmpp; + +import java.io.IOException; +import java.util.logging.Logger; +import javax.servlet.http.*; +import com.google.appengine.api.xmpp.JID; +import com.google.appengine.api.xmpp.Presence; +import com.google.appengine.api.xmpp.PresenceType; +import com.google.appengine.api.xmpp.XMPPService; +import com.google.appengine.api.xmpp.XMPPServiceFactory; + +// [START example] +@SuppressWarnings("serial") +public class PresenceServlet extends HttpServlet { + + private static final Logger log = Logger.getLogger(PresenceServlet.class.getName()); + + @Override + public void doPost(HttpServletRequest req, HttpServletResponse res) + throws IOException { + + XMPPService xmpp = XMPPServiceFactory.getXMPPService(); + Presence presence = xmpp.parsePresence(req); + + // Split the XMPP address (e.g., user@gmail.com) + // from the resource (e.g., gmail.CD6EBC4A) + String from = presence.getFromJid().getId().split("/")[0]; + + log.info("Received presence from: " + from); + + // Mirror the contact's presence back to them + xmpp.sendPresence(presence.getFromJid(), PresenceType.AVAILABLE, presence.getPresenceShow(), presence.getStatus()); + } +} +// [END example] diff --git a/appengine/xmpp/src/main/java/com/example/appengine/xmpp/SubscriptionServlet.java b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/SubscriptionServlet.java new file mode 100644 index 00000000000..9b42be66454 --- /dev/null +++ b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/SubscriptionServlet.java @@ -0,0 +1,47 @@ +/** + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.appengine.xmpp; + +import java.io.IOException; +import java.util.logging.Logger; +import javax.servlet.http.*; +import com.google.appengine.api.xmpp.JID; +import com.google.appengine.api.xmpp.Subscription; +import com.google.appengine.api.xmpp.XMPPService; +import com.google.appengine.api.xmpp.XMPPServiceFactory; + +// [START example] +@SuppressWarnings("serial") +public class SubscriptionServlet extends HttpServlet { + + private static final Logger log = Logger.getLogger(SubscriptionServlet.class.getName()); + + @Override + public void doPost(HttpServletRequest req, HttpServletResponse res) + throws IOException { + + XMPPService xmppService = XMPPServiceFactory.getXMPPService(); + Subscription sub = xmppService.parseSubscription(req); + + // Split the bare XMPP address (e.g., user@gmail.com) + // from the resource (e.g., gmail.CD6EBC4A) + String from = sub.getFromJid().getId().split("/")[0]; + + log.info("Received subscription event from: " + from); + } +} +// [END example] diff --git a/appengine/xmpp/src/main/webapp/WEB-INF/appengine-web.xml b/appengine/xmpp/src/main/webapp/WEB-INF/appengine-web.xml new file mode 100644 index 00000000000..032d1f1e269 --- /dev/null +++ b/appengine/xmpp/src/main/webapp/WEB-INF/appengine-web.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- [START_EXCLUDE] --> +<!-- + Copyright 2016 Google Inc. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- [END_EXCLUDE] --> +<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> + <application>YOUR-PROJECT-ID</application> + <version>YOUR-VERSION-ID</version> + <threadsafe>true</threadsafe> + + <inbound-services> + <service>xmpp_message</service> + <service>xmpp_presence</service> + <service>xmpp_subscribe</service> + <service>xmpp_error</service> + </inbound-services> + +</appengine-web-app> diff --git a/appengine/xmpp/src/main/webapp/WEB-INF/web.xml b/appengine/xmpp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000000..45daddaf86e --- /dev/null +++ b/appengine/xmpp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- [START_EXCLUDE] --> +<!-- + Copyright 2016 Google Inc. All Rights Reserved. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- [END_EXCLUDE] --> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + version="2.5"> + <servlet> + <servlet-name>error</servlet-name> + <servlet-class>com.example.appengine.xmpp.ErrorServlet</servlet-class> + </servlet> + <servlet-mapping> + <servlet-name>error</servlet-name> + <url-pattern>/_ah/xmpp/error/</url-pattern> + </servlet-mapping> + <servlet> + <servlet-name>messagereceiver</servlet-name> + <servlet-class>com.example.appengine.xmpp.MessageReceiverServlet</servlet-class> + </servlet> + <servlet-mapping> + <servlet-name>messagereceiver</servlet-name> + <url-pattern>/_ah/xmpp/message/chat/</url-pattern> + </servlet-mapping> + <servlet> + <servlet-name>messagesender</servlet-name> + <servlet-class>com.example.appengine.xmpp.MessageSenderServlet</servlet-class> + </servlet> + <servlet-mapping> + <servlet-name>messagesender</servlet-name> + <url-pattern>/messagesender</url-pattern> + </servlet-mapping> + <servlet> + <servlet-name>presence</servlet-name> + <servlet-class>com.example.appengine.xmpp.PresenceServlet</servlet-class> + </servlet> + <servlet-mapping> + <servlet-name>presence</servlet-name> + <url-pattern>/_ah/xmpp/presence/available/</url-pattern> + <url-pattern>/_ah/xmpp/presence/unavailable/</url-pattern> + <url-pattern>/_ah/xmpp/presence/probe/</url-pattern> + </servlet-mapping> + <servlet> + <servlet-name>subscription</servlet-name> + <servlet-class>com.example.appengine.xmpp.SubscriptionServlet</servlet-class> + </servlet> + <servlet-mapping> + <servlet-name>subscription</servlet-name> + <url-pattern>/_ah/xmpp/subscription/subscribe/</url-pattern> + <url-pattern>/_ah/xmpp/subscription/subscribed/</url-pattern> + <url-pattern>/_ah/xmpp/subscription/unsubscribe/</url-pattern> + <url-pattern>/_ah/xmpp/subscription/unsubscribed/</url-pattern> + </servlet-mapping> +</web-app> From 4a98ee60a3683d6737600e2f36c9e98809eeb78a Mon Sep 17 00:00:00 2001 From: Mete Atamel <atamel@google.com> Date: Mon, 25 Apr 2016 15:14:32 +0100 Subject: [PATCH 2/3] Minor fixes to my previous commit --- appengine/xmpp/pom.xml | 2 +- .../main/java/com/example/appengine/xmpp/PresenceServlet.java | 1 - .../java/com/example/appengine/xmpp/SubscriptionServlet.java | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/appengine/xmpp/pom.xml b/appengine/xmpp/pom.xml index 766688c937c..c7c90b8fce8 100644 --- a/appengine/xmpp/pom.xml +++ b/appengine/xmpp/pom.xml @@ -18,7 +18,7 @@ Copyright 2015 Google Inc. All Rights Reserved. <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <groupId>com.example.appengine</groupId> - <artifactId>appengine-helloworld</artifactId> + <artifactId>appengine-xmpp</artifactId> <parent> <groupId>com.google.cloud</groupId> <artifactId>doc-samples</artifactId> diff --git a/appengine/xmpp/src/main/java/com/example/appengine/xmpp/PresenceServlet.java b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/PresenceServlet.java index edc1f81cffe..f85486fa288 100644 --- a/appengine/xmpp/src/main/java/com/example/appengine/xmpp/PresenceServlet.java +++ b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/PresenceServlet.java @@ -19,7 +19,6 @@ import java.io.IOException; import java.util.logging.Logger; import javax.servlet.http.*; -import com.google.appengine.api.xmpp.JID; import com.google.appengine.api.xmpp.Presence; import com.google.appengine.api.xmpp.PresenceType; import com.google.appengine.api.xmpp.XMPPService; diff --git a/appengine/xmpp/src/main/java/com/example/appengine/xmpp/SubscriptionServlet.java b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/SubscriptionServlet.java index 9b42be66454..9f7f2832350 100644 --- a/appengine/xmpp/src/main/java/com/example/appengine/xmpp/SubscriptionServlet.java +++ b/appengine/xmpp/src/main/java/com/example/appengine/xmpp/SubscriptionServlet.java @@ -19,7 +19,6 @@ import java.io.IOException; import java.util.logging.Logger; import javax.servlet.http.*; -import com.google.appengine.api.xmpp.JID; import com.google.appengine.api.xmpp.Subscription; import com.google.appengine.api.xmpp.XMPPService; import com.google.appengine.api.xmpp.XMPPServiceFactory; From 737a5811e432d55fae69e2a94f73d2a0bd71e515 Mon Sep 17 00:00:00 2001 From: Mete Atamel <atamel@google.com> Date: Tue, 26 Apr 2016 11:06:06 +0100 Subject: [PATCH 3/3] Added couple of tags for doc --- appengine/xmpp/src/main/webapp/WEB-INF/appengine-web.xml | 2 ++ appengine/xmpp/src/main/webapp/WEB-INF/web.xml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/appengine/xmpp/src/main/webapp/WEB-INF/appengine-web.xml b/appengine/xmpp/src/main/webapp/WEB-INF/appengine-web.xml index 032d1f1e269..efe638217ee 100644 --- a/appengine/xmpp/src/main/webapp/WEB-INF/appengine-web.xml +++ b/appengine/xmpp/src/main/webapp/WEB-INF/appengine-web.xml @@ -18,11 +18,13 @@ <version>YOUR-VERSION-ID</version> <threadsafe>true</threadsafe> + <!-- [START handling_incoming_calls] --> <inbound-services> <service>xmpp_message</service> <service>xmpp_presence</service> <service>xmpp_subscribe</service> <service>xmpp_error</service> </inbound-services> + <!-- [END handling_incoming_calls] --> </appengine-web-app> diff --git a/appengine/xmpp/src/main/webapp/WEB-INF/web.xml b/appengine/xmpp/src/main/webapp/WEB-INF/web.xml index 45daddaf86e..5bbb66f21c2 100644 --- a/appengine/xmpp/src/main/webapp/WEB-INF/web.xml +++ b/appengine/xmpp/src/main/webapp/WEB-INF/web.xml @@ -25,6 +25,7 @@ <servlet-name>error</servlet-name> <url-pattern>/_ah/xmpp/error/</url-pattern> </servlet-mapping> + <!-- [START messagereceiver] --> <servlet> <servlet-name>messagereceiver</servlet-name> <servlet-class>com.example.appengine.xmpp.MessageReceiverServlet</servlet-class> @@ -34,6 +35,7 @@ <url-pattern>/_ah/xmpp/message/chat/</url-pattern> </servlet-mapping> <servlet> + <!-- [END messagereceiver] --> <servlet-name>messagesender</servlet-name> <servlet-class>com.example.appengine.xmpp.MessageSenderServlet</servlet-class> </servlet>