On Wed, Nov 15, 2017 at 3:22 PM, Kean Erickson <[email protected]> wrote: > Thanks you, Tatu. Unless I am misunderstanding, it does seem that my > ObjectMapper with JsonOrgModule() is being used, given that I can print JSON > properly in GET requests. > Is it necessary to have a provider class for the ObjectMapper which > implements ContextResolver<ObjectMapper>? Or would that incur added overhead > as you mentioned here? > https://github.com/FasterXML/jackson-jaxrs-providers/issues/86
I don't think your registering provider makes a big difference, as long as you make sure to return singleton mapper instance -- that is, if and when it is called for every request make sure not to have to construct new mapper every time. As to whether that is necessary I honestly do not know. Maybe someone else can help here. -+ Tatu +- > > > > On Tue, Nov 14, 2017 at 10:30 PM, Tatu Saloranta <[email protected]> wrote: >> >> On Tue, Nov 14, 2017 at 6:22 PM, Kean Erickson <[email protected]> >> wrote: >> > Hey there Tatu, >> > >> > >> > So after adding a provider class extending JacksonJaxbJsonProvider, I've >> > had >> > success in producing JSONObjects over GET requests, but there's still >> > some >> > trouble still with interpreting POSTed json in requests as JSONObject. I >> > was >> > curious, should writing a custom MessageBodyReader still be necessary >> > with >> > JsonOrgModule in use? >> >> It should work just fine for GETs, POSTs and PUTs. Should not require >> custom MessageBodyReader. >> >> It has been a while since I had to last manually set things up so >> unfortunately I don't know. >> But I think any datatype module should have similar issues so when >> searching for solutions >> (StackOverflow is often a good resource), may want to see if there are >> questions about >> more popular modules like Joda, Guava or Java8 date/time modules. >> >> Or more generally questions about injecting/initializing ObjectMapper to >> use. >> One trick is to get access to `ObjectMapper` framework uses and >> register module on that: >> this actually works as mapper is mutable before being used. >> So it may be possible to inject `ObjectMapper` on some entity you >> control, modify that, >> instead of trying to do the reverse. >> >> -+ Tatu +- > > -- > You received this message because you are subscribed to the Google Groups > "jackson-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
