Hey Tatu, I have one more question about JsonOrgModule.
I'm wondering if there's a way to distinguish whether the user sent a {} or
an "".. that is, whether they sent the correct type. In both cases it comes
through as {} for my setter, and I'm wondering if there's anything extra I
can do to handle for user error, like throw an exception when the wrong
type is provided. As a more general question, I'm wondering if there's any
way to enforce strict typing (integers vs strings).
On Wed, Nov 15, 2017 at 9:03 PM, Tatu Saloranta <[email protected]> wrote:
> On Wed, Nov 15, 2017 at 6:43 PM, Kean Erickson <[email protected]>
> wrote:
> > Thanks for all your help, I finally got it working both ways. Counter to
> > what other guides have said, having a ContextMapper was not necessary,
> nor
> > was having a class "JacksonConfigFeature implements Feature".
> >
> > Adding this singleton to my application (with extends
> > JacksonJaxbJsonProvider and consumes + produces) was all that was needed.
> >
> > @Provider
> > @Consumes(MediaType.APPLICATION_JSON)
> > @Produces(MediaType.APPLICATION_JSON)
> > public class JacksonConfigProvider extends JacksonJaxbJsonProvider {
> >
> > private final static ObjectMapper mapper =
> > new ObjectMapper()
> > .registerModule(new JsonOrgModule())
> > .registerModule(new JaxbAnnotationModule());
> >
> > JacksonConfigProvider() {
> > super(mapper, JacksonConfigProvider.DEFAULT_ANNOTATIONS);
> > }
> > }
> >
> > No jersey-specific junk needed. I'm relieved, this was really difficult
> due
> > to metric tonnes of misinformation online. Thanks again!
>
> Thank you for sharing this: it makes sense to me.
>
> Yes, so much old/mis-information. And sometimes frameworks
> adding wrapping around features like Jackson which tends to obfuscate
> more straight-forward usage.
>
> -+ 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.