Hi Tatu.
I'm not familiar with the jackson internal codebase, but here are my ideas from the external perspective.
IMHO checking limits regarding the json structure itself can only be done by jackson I guess. Since it performs
the JSON parsing and binding to java beans by itself (?). I don't know about other supported formats (XML etc.) but
it seems to make sense, that these should also be put under limits when needed. For my personal usecase, JSON would
be sufficient ;).
1) Sounds reasonable to introduce a new configuration container that allows setting limits. E.g. via configure(jsonLimits).
2) I think restrictions should be applicable to different formats. On first sight, there are some common topics like maxNestingDepth, maxTotalElements, maxElementsPerParent etc. I don't know if there are some specials for XML or JSON...
3) It depends where the parsing happens. There I would apply the limits. I think everything that comes after the parsing is too late.
Are there currently any hooks in the jackson API where one can be notified e.g. via listener / visitor when the JSON is parsed/traversed?
This way one could simply implement a counter by oneself without having to put the burden of implementation to jackson itself.
For other formats like XML I guess that jackson simply uses a standard XML parser. So I think one would have to write something
at XML parser level for the limits. One could discuss if jackson would be the right place to configure the XML parser (limits).
Maybe depends whether XML (and other formats) are first class citizens or only the JSON...
I didn't even know that jackson also supports XML as well :).
Thanks
Veit
> Gesendet: Montag, 29. Februar 2016 um 09:34 Uhr
> Von: "Veit Guna" <
Veit...@gmx.de>
> An:
jackso...@googlegroups.com
> Cc:
jackso...@googlegroups.com
> Betreff: Aw: Re: [jackson-user] Limit json payload
> To unsubscribe from this group and stop receiving emails from it, send an email to
jackson-user...@googlegroups.com.
> To post to this group, send email to
jackso...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
>