Hi Naresh,
in the user guide doc [1] there is a note on this (see the last para of
the respective chapter).
You can check out the Jackson JSON example [2] and see:
@Provider
public class MyObjectMapperProvider implements
ContextResolver<ObjectMapper> {
@Override
public ObjectMapper getContext(Class<?> type) {
ObjectMapper result = new ObjectMapper();
result.configure(Feature.INDENT_OUTPUT, true);
return result;
}
}
You should be able to set the other Jackson parameters there.
HTH,
~Jakub
[1]
http://jersey.java.net/nonav/documentation/latest/json.html#d4e894
[2]
http://download.java.net/maven/2/com/sun/jersey/samples/jacksonjsonprovider/1.6/jacksonjsonprovider-1.6-project.zip
On 03/29/2011 02:54 PM, nbaliga wrote:
> Jakub,
> I tried out what you mentioned w.r.t. the JSON POJO mapping feature. Looks
> like I will lose out on the
> JsonConfiguration.natural().rootUnwrapping(false) capability. That is, I
> want to see the @XmlRootElement's name value parameter in the output.
>
> Obviously this is a Jackson issue, if as you say, everything is delegated to
> Jackson in the JSON POJO mapping feature.
>
> After digging around a bit, I think I see that Jackson has an issue resolved
> for this in Jackson 1.7
> http://jira.codehaus.org/browse/JACKSON-163
> http://jira.codehaus.org/browse/JACKSON-163
>
> However in order to avail of this fix, i have to be able to access the
> SerializationConfig i.e. the ObjectMapper instance that Jersey is using.
>
> Any idea whether how I can go about doing this? Any way to pass
> configuration to Jackson via Jersey?
>
> Thanks,
> Naresh
>
>
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Jersey-hangs-when-invalid-JSON-is-sent-in-POST-request-tp6205397p6221112.html
> Sent from the Jersey mailing list archive at Nabble.com.
>