src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Stream.java
branchhttp-client-branch
changeset 56019 2cb33775fc6f
parent 56010 782b2f2d1e76
parent 48523 b95b08f3e1a8
child 56020 ae3a51bc5b9f
equal deleted inserted replaced
56010:782b2f2d1e76 56019:2cb33775fc6f
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   427         if (Log.requests()) {
   427         if (Log.requests()) {
   428             Log.logRequest("PUSH_PROMISE: " + pushRequest.toString());
   428             Log.logRequest("PUSH_PROMISE: " + pushRequest.toString());
   429         }
   429         }
   430         PushGroup<T> pushGroup = exchange.getPushGroup();
   430         PushGroup<T> pushGroup = exchange.getPushGroup();
   431         if (pushGroup == null) {
   431         if (pushGroup == null) {
   432             // no push handler set by the user code, i.e. cancel / reject
   432             Log.logTrace("Rejecting push promise stream " + streamid);
   433             IOException ex = new IOException("Stream " + streamid + " cancelled by users handler");
   433             connection.resetStream(pushStream.streamid, ResetFrame.REFUSED_STREAM);
   434             pushStream.cancelImpl(ex);
   434             pushStream.close();
   435             return;
       
   436         }
       
   437 
       
   438         if (pushGroup.noMorePushes()) {
       
   439             cancelImpl(new IllegalStateException("unexpected push promise"
       
   440                 + " on stream " + streamid));
       
   441             return;
   435             return;
   442         }
   436         }
   443 
   437 
   444         PushGroup.Acceptor<T> acceptor = pushGroup.acceptPushRequest(pushRequest);
   438         PushGroup.Acceptor<T> acceptor = pushGroup.acceptPushRequest(pushRequest);
   445         CompletableFuture<HttpResponse<T>> pushResponseCF = acceptor.cf();
   439         CompletableFuture<HttpResponse<T>> pushResponseCF = acceptor.cf();