On 7 Oct 2014, at 17:23, Stefan Bodewig wrote:
Yes, I know, but I need to get hold of the factory inside the
MessageBodyReader so either I use a fixed one (which might add new
dependencies to halbuilder-jaxrs) or let Jersey inject one.I was thinking about using RepresentationFactory#readRepresentation.
I must be missing something here - as I said, the *Reader and *Writer classes take a RepresentationFactory as it's constructor, you provide the .class to the RepresentationFactory using withReader/withWriter, and the RepresentationFactory constructs an instance of said reader/writer passing itself in the constructor.
So all Readers/Writers already have a hold of the factory....
The StandardRepresentationFactory is little more than:
new DefaultRepresentationFactory()
..withReader()
..withWriter()
adding both the XML and JSON readers/writers - you'd just be replacing your own reader.
Oh wait... I just realised MessageBodyReader is a JAX-RS thing and not the HalBuilder *Reader - now I understand the problem - we've been talking about two totally different class hierarchies :)
Since I know jack-squat about Jax-RS - I have no idea what I'm talking about here :)
Mark