【发布时间】:2014-10-13 16:38:47
【问题描述】:
我正在开发一个使用 Google App Engine 远程存储应用程序数据的项目。到目前为止,我已经创建了一个简单的类 GenericEntity 并使用 Google 的工具生成了一个支持 Cloud Endpoint。
@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 Explorer 在GenericEntityEndpoint 中成功创建和删除GenericEntity 的实例。
请求:
POST
Content-Type: application/json
X-JavaScript-User-Agent: Google APIs Explorer
{
"data": "hello SO!"
}
回复:
200 OK
问题是我想从本地桌面应用程序控制这些端点,但我对应该如何完成感到困惑。我想PersistenceManagerFactory 仅对 Google 的服务器是本地的,随后我的应用程序无法直接访问。我是否缺少最后一步,允许通过网络与这些生成的端点进行高级交互,还是我需要使用HttpUrlRequest 函数实现我自己的与服务器的接口?
【问题讨论】:
标签: java api google-app-engine cloud endpoint