0
當涉及到使用從我的Python API for Google App Engine生成的.JAR生成的API時,我有點困惑。調用Python API - Google App Engine
下面是一個方法和AsyncTask的示例,用於在數據存儲中創建和存儲Event實體。
您通常會使用請求/響應消息將數據傳遞給實體嗎?
我有了一個insert()方法的事件類,但它不會讓我過去的任何事件的細節,因爲它沒有任何setter方法/干將如請求/響應類
private void sendResultToServer(String eventDesc, String eventName,
String eventTime) {
ImhotepApiMessagesEventRequest newEvent = new ImhotepApiMessagesEventRequest();
newEvent.setEventDesc(eventDesc);
newEvent.setEventTitle(eventName);
newEvent.setEventTime(eventTime);
new SendResultToServerTask().execute(newEvent, null, null);
}
/**
* Handles the request to the Event Endpoint, to save a event, without
* blocking the UI.
*/
private class SendResultToServerTask extends
AsyncTask<ImhotepApiMessagesEventRequest, Void, Void> {
@Override
protected Void doInBackground(
ImhotepApiMessagesEventRequest... params) {
// TODO Auto-generated method stub
service.event();
return null;
}
AppEngine Java和Python API是分開的,並且移植Python代碼將不起作用。你似乎錯過了一些概念。您的示例是Java,因此您應該學習[Java Datastore API](https://developers.google.com/appengine/docs/java/datastore/)和[Samples](https://developers.google.com/appengine/ )。要回答您的問題,是的,您通常會在doPost事件處理程序中使用請求參數來將數據傳遞給實體,並從HTML表單或jQuery Ajax調用提交帖子。 –