< prev index next >

src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpResponse.java

Print this page

        

@@ -222,29 +222,29 @@
      */
     @FunctionalInterface
     public interface BodyHandler<T> {
 
         /**
-         * Return a {@link BodyProcessor BodyProcessor} considering the given response status
+         * Returns a {@link BodyProcessor BodyProcessor} considering the given response status
          * code and headers. This method is always called before the body is read
          * and its implementation can decide to keep the body and store it somewhere
          * or else discard it, by  returning the {@code BodyProcessor} returned
          * from {@link BodyProcessor#discard(java.lang.Object) discard()}.
          *
          * @param statusCode the HTTP status code received
          * @param responseHeaders the response headers received
-         * @return
+         * @return a response body handler
          */
         public BodyProcessor<T> apply(int statusCode, HttpHeaders responseHeaders);
 
         /**
          * Returns a response body handler which discards the response body and
          * uses the given value as a replacement for it.
          *
          * @param <U> the response body type
          * @param value the value of U to return as the body
-         * @return
+         * @return a response body handler
          */
         public static <U> BodyHandler<U> discard(U value) {
             return (status, headers) -> BodyProcessor.discard(value);
         }
 

@@ -258,11 +258,11 @@
          * header. If that charset is not supported then
          * {@link java.nio.charset.StandardCharsets#UTF_8 UTF_8} is used.
          *
          * @param charset the name of the charset to interpret the body as. If
          * {@code null} then charset determined from Content-encoding header
-         * @return a response handler
+         * @return a response body handler
          */
         public static BodyHandler<String> asString(Charset charset) {
             return (status, headers) -> {
                 if (charset != null) {
                     return BodyProcessor.asString(charset);

@@ -280,11 +280,11 @@
          * When the {@code HttpResponse} object is returned, the body has been completely
          * written to the file, and {@link #body()} returns a reference to its
          * {@link Path}.
          *
          * @param file the file to store the body in
-         * @return a response handler
+         * @return a response body handler
          */
         public static BodyHandler<Path> asFile(Path file) {
             return (status, headers) -> BodyProcessor.asFile(file);
         }
 

@@ -304,11 +304,11 @@
          * by the server. If the destination directory does not exist or cannot
          * be written to, then the response will fail with an {@link IOException}.
          *
          * @param directory the directory to store the file in
          * @param openOptions open options
-         * @return a response handler
+         * @return a response body handler
          */
         public static BodyHandler<Path> asFileDownload(Path directory, OpenOption... openOptions) {
             return (status, headers) -> {
                 String dispoHeader = headers.firstValue("Content-Disposition")
                         .orElseThrow(() -> unchecked(new IOException("No Content-Disposition")));

@@ -341,11 +341,11 @@
          * written to the file, and {@link #body()} returns a reference to its
          * {@link Path}.
          *
          * @param file the filename to store the body in
          * @param openOptions any options to use when opening/creating the file
-         * @return a response handler
+         * @return a response body handler
          */
         public static BodyHandler<Path> asFile(Path file, OpenOption... openOptions) {
             return (status, headers) -> BodyProcessor.asFile(file, openOptions);
         }
 

@@ -357,11 +357,11 @@
          * <p>
          * When the {@code HttpResponse} object is returned, the body has been completely
          * written to the consumer.
          *
          * @param consumer a Consumer to accept the response body
-         * @return a a response handler
+         * @return a response body handler
          */
         public static BodyHandler<Void> asByteArrayConsumer(Consumer<Optional<byte[]>> consumer) {
             return (status, headers) -> BodyProcessor.asByteArrayConsumer(consumer);
         }
 

@@ -371,11 +371,11 @@
          * from {@link BodyProcessor#asByteArray() BodyProcessor.asByteArray()}.
          * <p>
          * When the {@code HttpResponse} object is returned, the body has been completely
          * written to the byte array.
          *
-         * @return a response handler
+         * @return a response body handler
          */
         public static BodyHandler<byte[]> asByteArray() {
             return (status, headers) -> BodyProcessor.asByteArray();
         }
 

@@ -390,11 +390,11 @@
          * {@link java.nio.charset.StandardCharsets#UTF_8 UTF_8} is used.
          * <p>
          * When the {@code HttpResponse} object is returned, the body has been completely
          * written to the string.
          *
-         * @return a response handler
+         * @return a response body handler
          */
         public static BodyHandler<String> asString() {
             return (status, headers) -> BodyProcessor.asString(charsetFrom(headers));
         }
     }

@@ -604,11 +604,11 @@
         /**
          * Called if an error occurs receiving a response. For each request
          * either one of onResponse() or onError() is guaranteed to be called,
          * but not both.
          *
-         * @param request
+         * @param request the main request or subsequent push promise
          * @param t the Throwable that caused the error
          */
         void onError(HttpRequest request, Throwable t);
 
         /**

@@ -715,11 +715,11 @@
          * where neither the incoming requests are examined, nor the response
          * headers, and every push that the server sends is accepted. When the
          * join() call returns, all {@code HttpResponse}s and their associated
          * body objects are available.
          *
-         * @param <V>
+         * @param <V> the body type used for all responses
          * @param pushHandler a function invoked for each request or push
          * promise
          * @return a MultiProcessor
          */
         public static <V> MultiProcessor<MultiMapResult<V>,V> asMap(
< prev index next >