JSON (Jackson)
This module provides Jackson-based JSON serialization and deserialization for ServiceTalk Jersey router.
It is a replacement for jersey-media-json-jackson and allows avoiding the input stream adaptation that kicks in
with out-of-the-box body readers and also allows accepting/returning Single<Pojo> and Publisher<Pojo>
from resource methods.
Note: If using Jersey 3.X, replace all imports containing javax.ws with jakarta.ws, and replace the dependency with:
* servicetalk-data-jackson-jersey3-jakarta9 for Jersey 3.0.X
* servicetalk-data-jackson-jersey3-jakarta10 for Jersey 3.1.X
| This serializer can not currently be used with Server-Sent Events (SSE). |
Using a custom ObjectMapper
If you have configured a Jackson ObjectMapper and want to use it with this module, you need to provide it to the
JAX-RS runtime as
a ContextResolver.
To help with this, ServiceTalkJacksonSerializerFeature provides a helper method named newContextResolver that
can build a ContextResolver<JacksonSerializerFactory> from an ObjectMapper instance.
It is up to the user to properly register this ContextResolver with their application.
Using a custom JacksonSerializerFactory
Like with ObjectMapper, if you want to use a custom ServiceTalkJacksonSerializerFeature you need to provide it as
a ContextResolver.
ServiceTalkJacksonSerializerFeature provides a helper method named newContextResolver that
can build a ContextResolver<JacksonSerializerFactory> from an ServiceTalkJacksonSerializerFeature instance.
It is up to the user to properly register this ContextResolver with their application.