-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON-Jackson does not handle resource returning CompletionStage<X> #3672
Comments
@dandew Commented |
@computerlove Commented |
|
@computerlove Maybe worth trying to send a PR with your proposed fix? This bug is turning into a showstopper. |
Faced the exact same problem. Following lines of code helped fixed the issue. Made a local copy of org.glassfish.jersey.jackson.internal.jackson.jaxrs.base.ProviderBase and modified writeTo method as pointed out by @jerseyrobot .
I modified CompletionStageTest and found it to be working. |
@mageshwaranr Have you created a PR? Your snippet looks like a better version of my suggestion. |
Just now submitted a PR just now. |
For who is still waiting for the official fix and don't want (or can't) repack jersey-media-json-jackson with the patch for each new version, a quick simple workaround is to implement WriterInterceptor that changes the context GenericType. Both @computerlove or @mageshwaranr proposed code can be used. |
It seems like
jersey-media-json-jackson
is not up to date with the latest JAX-RS 2.1 features.I tried creating the following resource method:
This fails with stack trace
Returning a plain String with
text/plain
works as expected.Just as a test I build my own version of Jersey with some additional code in
org.glassfish.jersey.jackson.internal.jackson.jaxrs.base.ProviderBase.writeTo(...)
:The middle part unwrapping the CompletionStage is new.
This works.
So, have I missed something, or is the
CompletionStage
support not complete?The text was updated successfully, but these errors were encountered: