Hi.
I am new to restlet and I have coded a couple of ServerResource, the
second using XStream plugin following this tutorial:
http://wiki.restlet.org/docs_2.0/13-restlet/28-restlet/264-restlet.html
I get an exception:
org.codehaus.jettison.json.JSONException: A JSONObject text must
begin with '{' at character 1 of <?xml version="1.0" encoding="UTF-8"
?>
{"commons.profiles.core.domain.Profile":{"nickname":"pippo","email":"[email protected]"}}
I have made two simple test using directly Xstream, like:
XStream stream = new XStream(new JettisonMappedXmlDriver());
String xml = stream.toXML(profile);
System.out.println(xml);
stream.fromXML(xml);
and works perfectly but :
XstreamRepresentation xstreamRepresentation = new
XstreamRepresentation(MediaType.APPLICATION_JSON, profile);
System.out.println(IOUtils.toString(xstreamRepresentation.getStream()));
indeed gives me:
<?xml version="1.0" encoding="UTF-8" ?>
{"lavazza.commons.profiles.core.domain.Profile":{"nickname":"pippo","email":"[email protected]"}}
Any idea about this?
Thanks.
--
Daniele Dellafiore
http://danieledellafiore.net
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2639652