开发者

how to use com.google.appengine.api.datastore.Text with Jersey REST webservice

I have a entity with a com.google.appengine.api.datastore.Text property for storing over 500 chars entries.

The problem is the Jersey REST doesnt like the Text type. So i made the getter return a stringValue to get it to work with rest, like this:

public String getContent() {
  return content.getValue();
 }

 public v开发者_开发技巧oid setContent(Text content) {
  this.content = content;
 }

The error only comes when deploying to GAE, not when running development mode:

The type of the getter is java.lang.String but that of the setter is com.google.appengine.api.datastore.Text. They have to be the same.

What to do?


Do this:

public String getContent() {
    return content.getValue();
}

public void setContent(String data) {
    this.content = new Text(data);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜