The Resteasy implementation for javax.ws.rs.sse.OutboundSseEvent.Builder break few javadoc requirements:
- According to Builder mediaType(final MediaType mediaType) doc the default media type should be MediaType.TEXT_PLAIN
- Builder mediaType(final MediaType mediaType) and all Builder data(...) methods should throw NullPointerException when input parameter is null.
- OutboundSseEvent build() should throw IllegalArgumentException if neither comment nor data are set
Also when building a OutboundSseEvent from a builder using a javax.ws.rs.core.GenericEntity<> as follow:
I was expecting the result of outboundSseEvent.getType() to be the same as genericEntity.getRawType().
Actually it was not since the builder is building a GenericType<?> using only the genericType taken from genericEntity.getType().
So at runtime the MBW used to write the SseEvent will not be called with the exact data type as it would be if we were dealing with a classic response return such as:
In the example above the MBW will be called with the exact data type since org.jboss.resteasy.specimpl.BuiltResponse.getEntityClass() return the exact same type as genericEntity.getRawType()