jakartaee/jsonp-api

Add a standard BodyHandler and BodyPublisher

Thihup opened this issue · 0 comments

Since Java 11, there is the new HttpClient API.

However, to use it with JSON, it is always required to create an adapter class that converts a JSON that comes in String/InputStream to a Java object.

Having standard BodyHandler and BodyPublisher could easy the work done in the client side to interact with the HttpClient API.

There are already some Colletors in the API to interact with streams in Java 8, so I guess adding BodyHandlers and BodyPublisher would be possible too.

I just don't know which spec would be better to include this, if Jakarta Json Processing or Jakarta Json Binding.

Thoughts?

https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html
https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.BodyHandler.html
https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpRequest.BodyPublisher.html