Restlet POSTing JSON to Appengine error

人盡茶涼 提交于 2019-11-28 12:50:55

Just to let everybody know: I managed to get GAE+Restlet+JSON+GWT working after much fiddling. The process was really chaotic (reminded me of days programing for the Win32): I was just changing settings until it started working.

The problem that I was having is:

  1. It was serving the wrong representation (JSON, XML, GWT) to the wrong clients. Later it turned out that I had to pay attention to the order of methods inside the class. WTF??
  2. I could not get it to work on sub-path, e.g. /rest/*.

I'm not going to use Restlet for the following reasons (hint to authors):

  1. Documentation is scarce, inaccurate and sometimes contradictory (explaining thing in different ways in different parts of documentation).
  2. Configuration is not standard JAX-RS. I know they have an option to configure it as JAX-RS, but all examples in docs are not based on this.

Since then I switched to Jersey.

You encountered a limitation of GAE that several Restlet users faced.

Some time ago, GAE stopped supporting accepting chunked HTTP entity. We reproduced this issue with both POST and PUT and raw GAE Servlets, so this isn't Restlet related. See GAE issue: http://code.google.com/p/googleappengine/issues/detail?id=129

The only workaround we found is to not chunk entities, meaning being able to compute their size in advance.

In Restlet 2.1 M3 version that we just released, we added a simple "entityBuffering" property on ClientResource to facilitate this (set to 'false' by default).

We are in the process of upgrading our "First Application" example to illustrate the workaround. We also had to cope with GWT 2.2 breaking compatibility with its previous GWT 2.1 core API, so Restlet 2.1 will only work on GWT.

Addition details are available on this page: http://wiki.restlet.org/docs_2.1/13-restlet/21-restlet/318-restlet/303-restlet.html

Best regards,

Jerome

Restlet ~ Founder and Technical Lead ~ http://www.restlet.org

Noelios Technologies ~ http://www.noelios.com

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!