I've asked to subscribe to the list but have not gotten a reply. I can't post
till I'm accepted.
Anyway I got JsonRepresentation working with XSTREAM.
I changed several jars for JACKSON (ver 1.3.5, 1.5.5, 1.7.1 core and
mapper), but get the following exception in all cases.
Doesn't matter if I run stand alone or in Tomcat container
Jan 17, 2011 7:44:45 AM org.restlet.engine.http.connector.Connection
writeMessages
INFO: Error while writing an HTTP message
java.lang.NoSuchMethodError:
org.codehaus.jackson.JsonFactory.configure(Lorg/codehaus/jackson/JsonGenerator$Feature;Z)Lorg/codehaus/jackson/JsonFactory;
at
org.restlet.ext.jackson.JacksonRepresentation.createObjectMapper(JacksonRepresentation.java:119)
2011/1/17 Fabián Mandelbaum
Hello. You should send this to the list. Sorry for not being more
helpful. I'm a bit overloaded with work now.
On Sun, Jan 16, 2011 at 8:39 PM, wrote:
> I'm sending this because I'm not subscribed to the list yet. Hopefully
> it's not much of a bother.
>
> I am sending a request from a browser, and the respons is a representation
> of the POJO "Contact".
> the request header has this (plus others)
> **************************************************
> Accept:
> application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
>
> Accept-Encoding: gzip,deflate,sdch
> *******************************************
>
> I can return a Java object, or html or xml but I try to return json and
> the server returns the following:
>
> ********************************
> HTTP/1.1 200 OK
> Date: Sun, 16 Jan 2011 22:47:40 GMT
> Accept-Ranges: bytes
> Server: Restlet-Framework/2.0snapshot
> Content-Type: application/json
> Transfer-Encoding: chunked
> 0
> ***************************************
> (I used wireshark to get this info)
>
> On the server end I am doing this:
>
> Map attrib = request.getAttributes();
> attrib.put("Accept", MediaType.APPLICATION_JSON);
> request.setAttributes(attrib);
> response.setEntity(new ObjectRepresentation
> (contact,MediaType.APPLICATION_JSON));
>
>
> I have the jackson jars in my classpath:
> org.restlet.ext.jackson.jar
> jackson-all-1.7.1.jar
>
> I am not using the @Get annotation, I'm doing "new Restlet() {....."
>
> I thought changing the request "Accept" header attribute would change the
> null response, but it didn't.
>
> Am I trying to do something I shouldn't, or can't ?
> I apologize in advance if this is just stupid.
>
--
View this message in context:
http://restlet-discuss.1400322.n2.nabble.com/Jackson-exception-tp5931851p5931851.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2698714