http-client-branch: renamed PushPromiseHandler.withPushPromises into PushPromiseHandler.of http-client-branch
authordfuchs
Fri, 19 Jan 2018 16:48:12 +0000
branchhttp-client-branch
changeset 56034 43b531ed872b
parent 56033 db102c5ca88a
child 56035 2f3f5da13c4c
http-client-branch: renamed PushPromiseHandler.withPushPromises into PushPromiseHandler.of
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpResponse.java
test/jdk/java/net/httpclient/http2/ImplicitPushCancel.java
test/jdk/java/net/httpclient/http2/ServerPush.java
test/jdk/java/net/httpclient/http2/ServerPushWithDiffTypes.java
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpResponse.java	Fri Jan 19 15:57:21 2018 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpResponse.java	Fri Jan 19 16:48:12 2018 +0000
@@ -850,8 +850,8 @@
          * @return a push promise handler
          */
         public static <T> PushPromiseHandler<T>
-        withPushPromises(Function<HttpRequest,BodyHandler<T>> pushPromiseHandler,
-                         ConcurrentMap<HttpRequest,CompletableFuture<HttpResponse<T>>> pushPromisesMap) {
+        of(Function<HttpRequest,BodyHandler<T>> pushPromiseHandler,
+           ConcurrentMap<HttpRequest,CompletableFuture<HttpResponse<T>>> pushPromisesMap) {
             return new PushPromisesHandlerWithMap<>(pushPromiseHandler, pushPromisesMap);
         }
     }
--- a/test/jdk/java/net/httpclient/http2/ImplicitPushCancel.java	Fri Jan 19 15:57:21 2018 +0000
+++ b/test/jdk/java/net/httpclient/http2/ImplicitPushCancel.java	Fri Jan 19 16:48:12 2018 +0000
@@ -113,7 +113,7 @@
         ConcurrentMap<HttpRequest, CompletableFuture<HttpResponse<String>>> promises
                 = new ConcurrentHashMap<>();
         PushPromiseHandler<String> pph = PushPromiseHandler
-                .withPushPromises((r) -> BodyHandler.asString(), promises);
+                .of((r) -> BodyHandler.asString(), promises);
         HttpResponse<String> main = client.sendAsync(
                 HttpRequest.newBuilder(uri).build(),
                 BodyHandler.asString(),
--- a/test/jdk/java/net/httpclient/http2/ServerPush.java	Fri Jan 19 15:57:21 2018 +0000
+++ b/test/jdk/java/net/httpclient/http2/ServerPush.java	Fri Jan 19 16:48:12 2018 +0000
@@ -39,12 +39,10 @@
 import java.nio.file.*;
 import jdk.incubator.http.*;
 import jdk.incubator.http.HttpResponse.BodyHandler;
-import jdk.incubator.http.HttpResponse.BodySubscriber;
 import jdk.incubator.http.HttpResponse.PushPromiseHandler;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.function.Consumer;
-import java.util.function.Function;
 import java.util.function.UnaryOperator;
 
 import org.testng.annotations.AfterTest;
@@ -220,7 +218,7 @@
 
         // Example 5 - withXXX and everything as a consumer of optional byte[]
         PushPromiseHandler<Void> pushPromiseHandler =
-                PushPromiseHandler.withPushPromises(pushRequest -> {
+                PushPromiseHandler.of(pushRequest -> {
                                                        ByteArrayConsumer bc = new ByteArrayConsumer();
                                                        byteArrayConsumerMap.put(pushRequest, bc);
                                                        return BodyHandler.asByteArrayConsumer(bc);
--- a/test/jdk/java/net/httpclient/http2/ServerPushWithDiffTypes.java	Fri Jan 19 15:57:21 2018 +0000
+++ b/test/jdk/java/net/httpclient/http2/ServerPushWithDiffTypes.java	Fri Jan 19 16:48:12 2018 +0000
@@ -79,7 +79,7 @@
             HttpRequest request = HttpRequest.newBuilder(uri).GET().build();
 
             ConcurrentMap<HttpRequest,CompletableFuture<HttpResponse<BodyAndType<?>>>> results = new ConcurrentHashMap<>();
-            PushPromiseHandler<BodyAndType<?>> bh = PushPromiseHandler.withPushPromises(
+            PushPromiseHandler<BodyAndType<?>> bh = PushPromiseHandler.of(
                 (pushRequest) -> new BodyAndTypeHandler(pushRequest), results);
 
             CompletableFuture<HttpResponse<BodyAndType<?>>> cf = client.sendAsync(request, new BodyAndTypeHandler(request), bh);