Skip to content

[improvement] FeatureFlag to make Response the return type for binary Jersey Responses#37

Merged
iamdanfox merged 2 commits into
developfrom
jellis/jerseyBinaryAsResponse
Jul 16, 2018
Merged

[improvement] FeatureFlag to make Response the return type for binary Jersey Responses#37
iamdanfox merged 2 commits into
developfrom
jellis/jerseyBinaryAsResponse

Conversation

@ellisjoe
Copy link
Copy Markdown
Contributor

Before this PR

Currently binary response types are rendered as StreamingOutput. There's a bug in Jersey which causes a failure part way through streaming back that response to appear as a successful response to the client: eclipse-ee4j/jersey#3850

After this PR

By rendering Response as the return type we are still able to use StreamingOutput as the body of the response, but we are also able to include the Content-Length header when we know the size of the response. Including the content length allows clients to determine there was an error, even when the stream appeared to have been closed successfully.

@ellisjoe ellisjoe requested a review from iamdanfox July 12, 2018 13:53
@ellisjoe ellisjoe requested a review from ferozco July 12, 2018 14:21
@iamdanfox
Copy link
Copy Markdown
Contributor

I think this is an acceptable short-term solution - we'll probably want to follow up with a more first-class type for java servers so that people can actually specify these content lengths without this hack, but happy to unblock things for now!

@iamdanfox iamdanfox merged commit b7bfff3 into develop Jul 16, 2018
@iamdanfox iamdanfox deleted the jellis/jerseyBinaryAsResponse branch July 16, 2018 12:57
carterkozak pushed a commit to carterkozak/conjure-java that referenced this pull request Dec 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants