Skip to content

Instantly share code, notes, and snippets.

@mtigdemir
Last active August 29, 2015 14:10
Show Gist options
  • Save mtigdemir/05e13f519a9a0b09f75a to your computer and use it in GitHub Desktop.
Save mtigdemir/05e13f519a9a0b09f75a to your computer and use it in GitHub Desktop.
Google App Engine Channel Servlet
package com.mtigdemir;
import java.io.IOException;
import javax.servlet.http.*;
import com.google.appengine.api.channel.ChannelMessage;
import com.google.appengine.api.channel.ChannelService;
import com.google.appengine.api.channel.ChannelServiceFactory;
@SuppressWarnings("serial")
public class ServletTest extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
ChannelService channelService = ChannelServiceFactory.getChannelService();
channelService.sendMessage(new ChannelMessage("logger", "Connection Testing.. "));
}
}
<?xml version="1.0" encoding="utf-8"?>
<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>ServletTest</servlet-name>
<servlet-class>com.bumin.ServletTest</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletTest</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>Logger.jsp</welcome-file>
</welcome-file-list>
</web-app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment