简体   繁体   English

在GAE上有针对Restlet的开源项目吗?

[英]is there any open source project for Restlet on GAE available?

I am searching for open source project for Restlet hosted on GAE and trying to figure out the CRUD operation with restlet + objectify. 我正在寻找GAE上托管的Restlet的开源项目,并尝试使用restlet + objectify来解决CRUD操作。 in my current application i have used following, 在我当前的应用程序中,我使用了以下内容,

  • Using Restlet for rest full webservice 使用Restlet进行完整的Web服务
  • Objectify as ORM framwork. 客观化为ORM框架。
  • Hosted on GAE. 托管在GAE上。

I am not much clear for the how to request response with JSON representation in restlet. 对于如何在restlet中使用JSON表示形式请求响应,我不太清楚。

so if there is open source project going on google code or github it would help. 因此,如果有正在进行Google代码或github的开源项目,它将有所帮助。

Thanks 谢谢

I am using the same technologies in a project. 我在项目中使用了相同的技术。 If you're looking for JSON representation examples, the code below may help. 如果您正在寻找JSON表示示例,则下面的代码可能会有所帮助。 I am using Gson to handle JSON serialization/deserialization: 我正在使用Gson处理JSON序列化/反序列化:

public Foo() {

    private String name;

    public Foo() {};

    public Foo(String name) {
        this.name = name;
    }

    public String toJson() {
        return new Gson().toJson(this);
    }
}

@Get("json")
public Representation represent() {

    Foo foo = new Foo("bar");
    return new JsonRepresentation(foo.toJson());

}

@Post("json")
public Representation post(Representation entity) {

    JsonRepresentation json = null;

    try {

        json = new JsonRepresentation(entity);
        Gson gson = new Gson();
        Foo foo = gson.fromJson(json.getText(), Foo.class);

    } catch (Exception e) {
        System.err.println(e.getMessage());
    }

    return json;
}

i have found one 我找到了一个

blog engine: http://code.google.com/p/blogress/ 博客引擎: http : //code.google.com/p/blogress/

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

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