Way*_*gas 5 google-app-engine google-cloud-endpoints
我对谷歌应用引擎和端点非常陌生,一直在编写基本的端点功能并部署到云中。我成功部署了一个 HelloWorld 端点并通过 API Explorer 对其进行了测试:http://localhost:8080/_ah/api/explorer
但是现在当我创建了一个新的端点 API 并遵循相同的步骤(即在 appengine-web.xml 中使用新的 APP 引擎应用程序名称进行部署,以 appengine:update 运行)时,api 资源管理器仍然显示我的 HelloWorld 端点而不是我的新 API“你的第一端点”。
我已经搜索并试图找到无济于事的答案 - 如果这是我的一个非常基本和愚蠢的问题(我确定是),我很抱歉,但如果有人能指出我正确的方向,我将不胜感激我应该做什么。
我的API
package com.example.zinglife;
import com.google.api.server.spi.config.Api;
import com.google.api.server.spi.config.ApiMethod;
import com.google.api.server.spi.config.ApiMethod.HttpMethod;
import com.google.api.server.spi.response.NotFoundException;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
/**
*
* Defines endpoint functions APIs.
*/
@Api(name = "yourfirstapi", version = "v1",
scopes = {Constants.EMAIL_SCOPE },
clientIds = {Constants.API_EXPLORER_CLIENT_ID},
description = "API for hello world endpoints.")
public class YourFirstAPI
{
@ApiMethod(name = "storeUserModel")
private User storeUserModel(User user) throws NotFoundException
{
String email = user.getEmail();
Key key = KeyFactory.createKey("User",email);
User userEntity = null;
try
{
if (userEntity==null)
{
userEntity = new User();
userEntity.setName(user.getName());
userEntity.setEmail(user.getEmail());
userEntity.setCountry(user.getCountry());
//
}
return userEntity;
}//*endtry
finally
{
}
}
}
Run Code Online (Sandbox Code Playgroud)
运行代码后App引擎管理员日志:
如果需要任何其他信息,请告诉我:)
确保您已将新服务添加为 EndPointsServlet 的“services”参数的值之一。
<servlet>
<!-- This is version 2.0 of the endpoints framework. -->
<servlet-name>EndpointsServlet</servlet-name>
<servlet-class>com.google.api.server.spi.EndpointsServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<!-- Comma separated classes that provide endpoints -->
<param-value>
com.mycompany.myproduct.endpoint.SomeServiceV1,
com.mycompany.myproduct.endpoint.SomeServiceV2,
com.mycompany.myproduct.endpoint.SomeOtherServiceV1,
com.mycompany.myproduct.endpoint.SomeOtherServiceV2,
com.mycompany.myproduct.endpoint.SomeOtherServiceV3
</param-value>
</init-param>
</servlet>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
674 次 |
最近记录: |