playframework / playframework/playframework

Incorrect Play 2.5.x JavaWS documentation page

Open
#8,545 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic:documentation
Dominant language
Scala
Stars
12.6k
Forks
4k
Avg merge
2d 3h
Merged PRs (30d)
29

Description

The following section of the documentation states that the WS client does not support streaming upload:

https://www.playframework.com/documentation/2.5.x/JavaWS#Accessing-AsyncHttpClient

It's not very clear from just the link to FeedableBodyGenerator how exactly we are supposed to solve this problem, but more importantly the WS client does in fact support streaming uploads! Depending on which method signatures you are looking at it may not look like it, and checking the documentation will confirm that incorrect assumption. Suppose you have a bytestring source and you want to POST it somewhere.

ws
  .url("http://foo")
  .post(/* many things are allowed here, but nothing that helps */);

The overloads for the post and similar methods on WSRequest don't support streaming, however it is supported just fine with setBody:

ws
  .url("http://foo")
  .setBody(mySource)
  .execute("POST");

Where mySource is an instance of akka.stream.javadsl.Source<ByteString, ?>.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the JavaWS documentation section at https://www.playframework.com/documentation/2.5.x/JavaWS#Accessing-AsyncHttpClient and verify the current statement about streaming uploads. Update the section to explain the setBody(mySource).execute("POST") approach and remove the incorrect claim that streaming uploads are unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.