Skip to content

Request streaming for Apache HttpClient #312

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

Closed
wants to merge 1 commit into from

Conversation

poutsma
Copy link
Contributor

@poutsma poutsma commented Jul 9, 2013

  • Added org.springframework.http.StreamingHttpOutputMessage, which
    allows for a settable request body (as opposed to an output stream).
  • Added http.client.HttpComponentsStreamingClientHttpRequest, which
    implements the above mentioned interface, mapping setBody() to a
    setEntity() call on the Apache HttpClient HttpEntityEnclosingRequest.
  • Added a 'bufferRequestBody' property to the
    HttpComponentsClientHttpRequestFactory. When this property is set to
    false (default is true), we return a
    HttpComponentsStreamingClientHttpRequest instead of a (request
    buffering) HttpComponentsClientHttpRequest.

Issue: SPR-10728

@poutsma
Copy link
Contributor Author

poutsma commented Jul 9, 2013

@rstoyanchev Could you take a look at this?

- Added org.springframework.http.StreamingHttpOutputMessage, which
  allows for a settable request body (as opposed to an output stream).

- Added http.client.HttpComponentsStreamingClientHttpRequest, which
  implements the above mentioned interface, mapping setBody() to a
  setEntity() call on the Apache HttpClient HttpEntityEnclosingRequest.

- Added a 'bufferRequestBody' property to the
  HttpComponentsClientHttpRequestFactory. When this property is set to
  false (default is true), we return a
  HttpComponentsStreamingClientHttpRequest instead of a (request
  buffering) HttpComponentsClientHttpRequest.

Issue: SPR-10728
@rstoyanchev
Copy link
Contributor

This is now in master.

@Override
protected OutputStream getBodyInternal(HttpHeaders headers) throws IOException {
throw new UnsupportedOperationException(
"getBody not supported when bufferRequestBody is false");

Choose a reason for hiding this comment

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

Hi, I was trying to implement a custom patch for this solution on my own. That's when I saw that you guys were already working on this. If you throw an exception when getBody is called, then how will the body be flushed to the stream?

Choose a reason for hiding this comment

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

+1
I've tested FormHttpMessageConverter and it is broken for HttpComponentsClientHttpRequestFactory with setBufferRequestBody set to false

Copy link
Member

Choose a reason for hiding this comment

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

Could you create an issue on https://jira.spring.io and explain the problem there?
Thanks!

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

ok thanks!

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.

5 participants