GAE 上有可用的 Restlet 开源项目吗?

发布于 2024-10-08 19:54:39 字数 290 浏览 0 评论 0原文

我正在寻找 GAE 上托管的 Restlet 的开源项目,并尝试使用 Restlet + objectify 找出 CRUD 操作。在我当前的应用程序中,我使用了以下内容,

  • 使用 Restlet 来实现完整的 Web 服务
  • Objectify 作为 ORM 框架。
  • 主办于GAE。

我不太清楚如何在 Restlet 中使用 JSON 表示请求响应。

因此,如果 google code 或 github 上有开源项目,那将会有所帮助。

谢谢

I am searching for open source project for Restlet hosted on GAE and trying to figure out the CRUD operation with restlet + objectify. in my current application i have used following,

  • Using Restlet for rest full webservice
  • Objectify as ORM framwork.
  • Hosted on GAE.

I am not much clear for the how to request response with JSON representation in restlet.

so if there is open source project going on google code or github it would help.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

深陷 2024-10-15 19:54:39

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

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;
}
耶耶耶 2024-10-15 19:54:39

我找到了一个

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

i have found one

blog engine: http://code.google.com/p/blogress/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文