@@ -106,6 +108,51 @@ public interface HttpClientResponse {
*/
+ * If the HTTP statusCode is not in the 2XX range a HttpException is throw which contains
+ * the HttpResponse. This is the cause in the CompletionException.
+ *
+ * @param type The parameterized type of the bean to convert the response content into.
+ * @return The bean the response is converted into.
+ * @throws HttpException when the response has error status codes
+ */
+
+ * If the HTTP statusCode is not in the 2XX range a HttpException is throw which contains
+ * the HttpResponse. This is the cause in the CompletionException.
+ *
+ * @param type The parameterized type of the bean to convert the response content into.
+ * @return The list of beans the response is converted into.
+ * @throws HttpException when the response has error status codes
+ */
+
+ * Typically the response is expected to be {@literal application/x-json-stream}
+ * newline delimited json payload.
+ *
+ * Note that for this stream request the response content is not deemed
+ * 'loggable' by avaje-http-client. This is because the entire response
+ * may not be available at the time of the callback. As such {@link RequestLogger}
+ * will not include response content when logging stream request/response
+ *
+ * If the HTTP statusCode is not in the 2XX range a HttpException is throw which contains
+ * the HttpResponse. This is the cause in the CompletionException.
+ *
+ * @param type The parameterized type of the bean to convert the response content into.
+ * @return The stream of beans from the response
+ * @throws HttpException when the response has error status codes
+ */
+
diff --git a/client/src/main/java/io/avaje/http/client/JsonbBodyAdapter.java b/client/src/main/java/io/avaje/http/client/JsonbBodyAdapter.java
index b678072..610c877 100644
--- a/client/src/main/java/io/avaje/http/client/JsonbBodyAdapter.java
+++ b/client/src/main/java/io/avaje/http/client/JsonbBodyAdapter.java
@@ -1,13 +1,15 @@
package io.avaje.http.client;
-import io.avaje.jsonb.JsonType;
-import io.avaje.jsonb.Jsonb;
-
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
+import io.avaje.jsonb.JsonType;
+import io.avaje.jsonb.Jsonb;
+
/**
- * avaje jsonb BodyAdapter to read and write beans as JSON.
+ * Avaje Jsonb BodyAdapter to read and write beans as JSON.
*
* {@code
*
@@ -21,9 +23,9 @@
public final class JsonbBodyAdapter implements BodyAdapter {
private final Jsonb jsonb;
- private final ConcurrentHashMap
> listReader(ParameterizedType cls) {
+ return (BodyReader
>) listReaderCache.computeIfAbsent(cls, aClass -> new JReader<>(jsonb.type(cls).list()));
+ }
+
@SuppressWarnings("unchecked")
@Override
public
> listReader(Class