hi,

OK I had some progress:

I pushed a header in the HTTP post request :

Content-Type: application/json

apparently this header overrides the default content type which is
application/x-www-form-urlencoded   for form submitting.

So... now it seems that Restlet found a converter (JSON) but I get a new
exception due to the fact that the Entity is urlencoded...

Here is the stacktrace (I trimmed most of the form content since it's not
relevant):

org.restlet.resource.UniformResource doCatch
WARNING: Exception or error caught in resource
com.thoughtworks.xstream.io.StreamException:  :
org.codehaus.jettison.json.JSONException: A JSONObject text must begin with
'{' at character 1 of
json=%7B%22com.mydomain.app.dm.item.Item%22%3A%7B%22%22%3A%22%3F%EE%3F%FB%3F%F2%3F%AE%3F%EF+%3F%EE%3F%EA%3F%F3%3F%AE%3F%EF%3F%FC%22%2C%22sourceID%22%3A%22696%22%2C%22%22%3A%22%3F%B6%3F%AE%3F%2%7D%7D
    at
com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver.createReader(JettisonMappedXmlDriver.java:67)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:867)
    at
org.restlet.ext.xstream.XstreamRepresentation.getObject(XstreamRepresentation.java:148)
    at
org.restlet.ext.xstream.XstreamConverter.toObject(XstreamConverter.java:167)
    at
org.restlet.service.ConverterService.toObject(ConverterService.java:156)

I hope I'm in the right direction.

Is this a bug or maybe I'm missing something?

Thanks,

Chen.

On Mon, Apr 12, 2010 at 23:45, Chen Bekor <[email protected]> wrote:

> hi,
>
> A few additional notes -
>
> The annotated method looks like this:
>
> @Put("json")
> public void insertItem(Item myItem){
>
> //insert item into DataStore
> }
>
> when running my test client I get the error:
>
>
> Unable to find a converter for this representation :
> [application/x-www-form-
> urlencoded]
>
> When I try to remove the method parameter I can breakpoint inside the
> method which means Restlet is fails to translate the Form Entity into my
> "Item" class.
>
> Maybe the problem is in the way I build my client post object? How does
> Restlet maps the json to the class? Do I need to write the json
> representation of my client Object using some convention like same
> getter/setter names and maybe full package name?
>
> Thanks,
>
> Chen.
>
>
> On Mon, Apr 12, 2010 at 23:05, Chen Bekor <[email protected]> wrote:
>
>> hi,
>>
>> I'm using the 2.0 Snapshot (2010-04-09) for the GAE distro
>>
>>
>>
>> On Mon, Apr 12, 2010 at 22:36, Thierry Boileau <
>> [email protected]> wrote:
>>
>>> Hello Chen,
>>>
>>> could you tell us what release of the Restlet framework are you using?
>>>
>>> Best regards,
>>> Thierry Boileau
>>>
>>> ------------------------------------------------------
>>>
>>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2579096
>>>
>>
>>
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2580153

Reply via email to