Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/399.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 谷歌应用程序引擎在哪里;s云端点?_Java_Api_Google App Engine_Cloud_Endpoint - Fatal编程技术网

Java 谷歌应用程序引擎在哪里;s云端点?

Java 谷歌应用程序引擎在哪里;s云端点?,java,api,google-app-engine,cloud,endpoint,Java,Api,Google App Engine,Cloud,Endpoint,我正在从事一个项目,该项目使用谷歌应用程序引擎远程存储应用程序数据。到目前为止,我已经创建了一个简单的类GenericEntity,并使用谷歌的工具生成了一个支持云的端点 @PersistenceCapable(identityType = IdentityType.APPLICATION) public class GenericEntity { /* Define the UniqueID as persistent and unique. Allow JDO to assign the

我正在从事一个项目,该项目使用谷歌应用程序引擎远程存储应用程序数据。到目前为止,我已经创建了一个简单的类
GenericEntity
,并使用谷歌的工具生成了一个支持云的端点

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class GenericEntity {

/* Define the UniqueID as persistent and unique. Allow JDO to assign the value of UniqueId when uploaded with a null id. */
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@GeneratedValue(strategy = GenerationType.AUTO)
private Long mUniqueId; // Value must be 'Long' and not a primitive 'long'!

@Persistent
private String mData;
[...]
我还可以使用API资源管理器在
GenericEntityEndpoint
中成功创建和删除
GenericEntity
的实例

请求:

POST 

Content-Type:  application/json
X-JavaScript-User-Agent:  Google APIs Explorer

{
"data": "hello SO!"
}
答复:

200 OK

问题是我想从本地桌面应用程序控制这些端点,但我不知道应该如何实现。我设想,
PersistenceManagerFactory
只在谷歌的服务器上运行,因此我的应用程序无法直接访问它。是否有我遗漏的最后一个步骤允许通过网络与这些生成的端点进行高级交互,或者我需要使用
HttpUrlRequest
函数实现自己与服务器的接口吗?

云端点使用REST或RPC over HTTP发送JSON数据,身份验证使用OAuth2进行管理,因此您可以从头开始编写桌面应用程序,也可以使用各种Google库连接到端点。对于Java应用程序,我通常使用您可以使用endpoint.sh生成的Android云端点库,我使用为Android生成的类从任何其他Java应用程序调用云端点:

appengine-java-sdk-x.x.x/bin/endpoints.sh <command> <options> [class-name]

谢谢你非常详细和翔实的回答。我将为Eclipse安装Android设备工具(ADT)插件以及它的依赖项,希望这将允许我按照您的建议在现有项目中生成客户端API。欢迎您。如果您不是为Android开发,您不需要安装ADT,命令行工具endpoint.sh生成可以在任何Java应用程序中使用的Java类,因此您可以在正常的Eclipse中使用这些文件
Endpoint endpoint = Endpoint.Builder(
                        HTTP_TRANSPORT, JSON_FACTORY, getCredential()).build();