Quantcast

Strange behavior with StreamingOutput as entity

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Strange behavior with StreamingOutput as entity

Cowtowncoder
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 +-
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Strange behavior with StreamingOutput as entity

Marek Potociar
Hi Tatu,
can you look at the jersey-tests module and unit tests there. You should be able to use the Jersey test framework to write the unit test.

HTH,
Marek

On Apr 28, 2012, at 12:38 AM, Tatu Saloranta wrote:

> 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 +-

Loading...