users@jersey.java.net

[Jersey] Strange behavior with StreamingOutput as entity

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Fri, 27 Apr 2012 15:38:10 -0700

I bumped into an interesting bug (or feature?), wherein a
StreamingOutput implementation which has at least one discoverable
property (has a getter [and for JAXB, setter]) gets serialized as a
POJO, instead of being handled as expected. Removing property fixes
things.

I tried debugging this with Jackson JAX-RS provider; but it should
already be handling this case; and calling "isWritableType" on
provider (with StreamingOutput implementation) returns false.

So I am wondering if there might be different between resource methods
that declare they return StreamingOutput; and ones that return Entity
that contain a StreamingOutput implementation?
This was with Jersey 1.12 (one bundled by DropWizard)

I was also hoping to figure out a way to reproduce this problem,
running some version of embedded Jersey in unit tests, but couldn't
quite yet figure it out. If anyone has pointers to good sample code,
please let me know. I would love to contribute a unit test, if this is
considered a bug.

-+ Tatu +-