Skip to content
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

flush every chunk only for chunked responses #245

Merged
merged 2 commits into from
Jun 2, 2014

Conversation

yanns
Copy link
Member

@yanns yanns commented May 14, 2014

let the servlet container buffer the response.
Based on feedback from @jroper:
yanns@b580b8c#commitcomment-6312809
yanns@b580b8c#commitcomment-6312832

yanns referenced this pull request in yanns/play2-war-plugin May 14, 2014
The handling of a play result in the default request handler is moved
to pushPlayResultToServletOS. This handling stayed the same. This change
should not have any impact on the existing servlet wrapper for servlet < 3.1.

For servlet 3.1, pushPlayResultToServletOS is overwritten to provide a
non-blocking asynchron handling based on the new WriteListener.
@dlecan
Copy link
Member

dlecan commented May 14, 2014

Good work !

@@ -223,7 +229,7 @@ class Play2Servlet31RequestHandler(servletRequest: HttpServletRequest)

setHeaders(headers, httpResponse)

val chunked = headers.exists { case (key, value) => key == HeaderNames.TRANSFER_ENCODING && value == HttpProtocol.CHUNKED }
chunked = headers.exists { case (key, value) => key == HeaderNames.TRANSFER_ENCODING && value == HttpProtocol.CHUNKED }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key.equalsIgnoreCase(...) would be technically correct here. Though we don't do it in Play... we probably should. I think this is going to be fixed by a PR in the works that converts the headers map to be case insensitive.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, added a commit for this.

@yanns
Copy link
Member Author

yanns commented Jun 2, 2014

@dlecan can you merge this pull or do you need more info/time?

dlecan added a commit that referenced this pull request Jun 2, 2014
flush every chunk only for chunked responses
@dlecan dlecan merged commit 2259ea6 into play2war:develop Jun 2, 2014
@dlecan dlecan added this to the v1.2 milestone Jun 11, 2014
@yanns yanns deleted the flush-optimization branch June 23, 2014 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants