-
Bug
-
Resolution: Done
-
Major
-
4.0.0.Beta3
-
None
An InboundSseEvent received from an SseEventSource built from a WebTarget which was in turn built from a Client that has registered a customer provider (in this specific case a ContextResolver<ObjectMapper> for customizing JSON serialization) will not see the custom providers when attempting to call readData on the event.
class MyCustomJSONObjectMappResolver implements ContextResolver<ObjectMapper> { ... }; Client client = ClientBuilder.newClient().register(MyCustomJSONObjectMapperResolver.class); WebTarget endpoint = client.target("http://server.example.com/events"); SseEventSource source = SseEventSource.target(endpoint).build(); source.register(event -> { // The following line will use the "default" ObjectMapper configured in ResteasyJackson2Provider instead of the one provided by MyCustomJSONObjectMapperResolver event.readData(MyCustomType.class, MediaType.APPLICATION_JSON_TYPE); }); source.open();
I believe the reason is fairly apparent. In InboundSseEventImpl.java:195 it magics up it's on instance of ResteasyProviderFactory and uses that to lookup providers. I believe the InboundSseEventImpl should carry a reference to the SseEventSource that spawned it and use the configuration available from its ClientWebtarget to lookup providers.
- relates to
-
RESTEASY-1940 SseEventSourceImpl has no context
- Resolved