简体   繁体   English

objectify,JavaScript和Google端点

[英]objectify, javascript and google endpoint

I am trying to figure out how integration between google endpoint, objectify and javscripts works. 我试图弄清楚谷歌端点,objectify和javscripts之间的集成是如何工作的。 I made a real simple class named 'User'. 我做了一个真正简单的类,叫做“用户”。 All I am trying is to fetch a record from a Data Store and return this object back and use this in javascript. 我正在尝试的只是从数据存储中获取一条记录,然后将该对象返回并在javascript中使用它。

However, the object does not seem to flow back properly. 但是,该对象似乎不能正确地回流。 I do not see any details around this object using Chrome's developer tools... Any ideas? 使用Chrome的开发人员工具,我看不到该对象的任何详细信息...有什么想法吗? FYI, the record exists in the data store as I can see it while using the development console. 仅供参考,正如我在使用开发控制台时看到的那样,该记录存在于数据存储中。 I also can see the information as I've logged this info to the console as well. 我也已将该信息记录到控制台,因此也可以看到该信息。 Thanks. 谢谢。

** JAVA CLASS ** package com.Backend; ** JAVA CLASS **包com.Backend;

import com.googlecode.objectify.annotation.*;

@Entity
public class User {
    String firstName;
    String lastName;
    @Id String email;

public User(){
    super();
}

public User(String firstName, String lastName, String email) {
    super();
    this.firstName = firstName;
    this.lastName = lastName;
    this.email = email;
}

public String getFirstName() {
    return firstName;
}

public void setFirstName(String firstName) {
    this.firstName = firstName;
}

public String getLastName() {
    return lastName;
}

public void setLastName(String lastName) {
    this.lastName = lastName;
}

public String getEmail() {
    return email;
}

public void setEmail(String email) {
    this.email = email;
}
}

** GOOGLE ENDPOINT ** ** GOOGLE ENDPOINT **

public class UserEndpoint {

private static final Logger LOG = Logger.getLogger(UserEndpoint.class.getName());

static {
    ObjectifyService.register(User.class);
}

@ApiMethod(name = "getUser")
public User getUser() {
    User u = ofy().load().type(User.class).id("johndoe@domain.com").now();
    return u;
}
}

Finally found out what the issue is. 终于找出问题所在。 It has to do with how the object was returned... It did not have any return value. 它与对象的返回方式有关...它没有任何返回值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM