【发布时间】:2016-01-08 00:15:55
【问题描述】:
我的 GAE Cloud 端点中有以下 Api 方法:
@ApiMethod(name = "getConferences", path = "get_conferences", httpMethod = ApiMethod.HttpMethod.POST)
public List<Conference> getConferences(@Named("userId") Long userId) {
List<Conference> conferenceList = ofy().load().type(Conference.class)
.ancestor(Key.create(User.class, userId))
.order("-createdDate").list();
return conferenceList;
}
它工作得很好,并为我返回给定用户创建的所有会议,按日期排序。 Conference 类具有以下属性来指定它有一个 User 父类:
@Parent
private Key<User> userKey;
我的问题是,如何更改上述方法以一次仅返回 50 个结果(会议),并且还能够指定一个参数,该参数采用 nextPageToken 之类的参数来给我接下来的 50 个结果?
我已经在其他 API 方法中看到了这一点,但似乎找不到一个很好的 GAE 或 Cloud Endpoints 示例。
【问题讨论】:
标签: google-app-engine google-cloud-endpoints objectify