playframework / playframework/playframework
Java Routing DSL does not enable to stream requests body
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 12.6k
- Forks
- 4k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 29
Description
Java Routing DSL enables to stream responses using the play.routing.RoutingDsl.PathPatternMatcher.routingAsync() method. However Java Routing DSL does not enable to stream a request body.
Indeed, even the play.mvc.Http.Request.body().asRaw() method returns an object where the whole body request is loaded into memory (as a String field).
By looking at the documentation, I can see that body parsers may be configured to enable to stream request body. However, in Java Routing DSL, body parsers cannot be configured.
Would it be possible to add a method like play.mvc.Http.Request.body().asAsyncRaw() that would return a org.reactivestreams.Publisher?
The publisher option would be the most developer friendly, but else an option to customize the body parsers for Java Routing DSL would do the job.
For information, I detailed this issue/feature request in https://discuss.lightbend.com/t/using-custom-body-parser-with-the-embedded-play-server/5753
Play Version
2.8.1
API
Java
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with play.routing.RoutingDsl.PathPatternMatcher.routingAsync() and compare its response streaming behavior with play.mvc.Http.Request.body().asRaw(). Read the body-parser documentation and the linked discussion to understand the requested Java Routing DSL integration. Done means Java routes can stream request bodies without loading the whole body into memory, using either the requested publisher or configurable body parsers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100