eclipse-ee4j / eclipse-ee4j/jersey
ServletContext is invalid in MessageBodyWriter if handling async CompletionStage
Open
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
My resources return CompletionStage and then I have a MessageBodyWriter for MyType. The issue is that if the CompletionStage is not immediately complete upon returning from resource method then the MessageBodyWriter fails because the ServletContext accessed from HttpServletRequest has already been invalidated and set to null (by Jetty 11).
Is there a way around this so that the HttpServletRequest (injected with Provider in MessageBodyWriter constructor and accessed in the writeTo method) becomes valid again? Or is this just a bug that needs to be fixed in Jersey?
Contributor guide
Assessment
This issue has not been assessed yet.