在Android Studio中将新端点添加到现有App Engine后端服务器

时间:2016-04-09 20:57:05

标签: java google-app-engine google-cloud-messaging

我的App Engine后端在我的本地Android Studio中设置了Google Cloud Messaging。

它的原始端点如下:

  • Messaging Endpoint
  • 注册端点

我创建了一个新的Java文件并添加了一个名为for n in range(nspins): for m in range(nspins): M += scalars[n, k].real的新类,如下所示:

UserRegistration

但是,部署后,我在API资源管理器中看不到此端点。如何使用Google Cloud Messaging将新的工作端点添加到App Engine后端?

1 个答案:

答案 0 :(得分:1)

通过现有的代码结构,我发现必须将每个新API添加到web.xml文件中。我将我的新端点添加为:

<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
  <filter>
        <filter-name>ObjectifyFilter</filter-name>
        <filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class>
  </filter>
  <filter-mapping>
        <filter-name>ObjectifyFilter</filter-name>
        <url-pattern></url-pattern>
  </filter-mapping>
   <servlet>
        <servlet-name>SystemServiceServlet</servlet-name>
        <servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
        <init-param>
            <param-name>services</param-name>
            <param-value>com.xxxxx.gcmbackend.RegistrationEndpoint, com.xxxxx.gcmbackend.MessagingEndpoint, com.xxxxx.gcmbackend.UserRegistrationEndpoint</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>SystemServiceServlet</servlet-name>
        <url-pattern>/_ah/spi/*</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
</web-app>