No, you have to do a wrapper. That's something i thought about but jackson config can be really more advanced and attribute config doesnt work well Le 12 mars 2013 02:03, "Anthony Fryer" <[email protected]> a écrit :
> I'm using the JacksonJsonProvider and have the resources.xml file below... > > <resources> > <Service id="jsonProvider" > class-name="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/> > <Service id="jaxbProvider" > class-name="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider"/> > </resources> > > Is it possible to configure the JacksonJsonProvider in resources.xml with > the following configuration that can be done programatically? > > JacksonJsonProvider p = new JacksonJsonProvider(); > ObjectMapper mapper = new ObjectMapper(); > objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, > false); > objectMapper.configure(SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS, > false); > objectMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, > true); > objectMapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); > objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, true); > p.setMapper(mapper); > > Something like this would be good... > > <resources> > <Service id="jsonProvider" > class-name="org.codehaus.jackson.jaxrs.JacksonJsonProvider"> > writeDatesAsTimestamps = false > serializationInclusion = non_null > </Service> > </resources> > > > > -- > View this message in context: > http://openejb.979440.n4.nabble.com/How-to-configure-JacksonJsonProvider-in-resources-xml-tp4661412.html > Sent from the OpenEJB User mailing list archive at Nabble.com. >
