Skip to content

Commit 1c713f8

Browse files
committed
Move Http2ClientPush to impl package
1 parent 19a38a5 commit 1c713f8

File tree

7 files changed

+20
-26
lines changed

7 files changed

+20
-26
lines changed

vertx-core/src/main/java/io/vertx/core/http/impl/Http1xClientConnection.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import io.vertx.core.http.HttpVersion;
3838
import io.vertx.core.http.WebSocketVersion;
3939
import io.vertx.core.http.impl.headers.HeadersAdaptor;
40-
import io.vertx.core.http.impl.http2.Http2ClientPush;
4140
import io.vertx.core.internal.ContextInternal;
4241
import io.vertx.core.internal.PromiseInternal;
4342
import io.vertx.core.internal.buffer.BufferInternal;
@@ -524,7 +523,7 @@ public HttpClientStream priorityChangeHandler(Handler<StreamPriority> handler) {
524523
}
525524

526525
@Override
527-
public HttpClientStream pushHandler(Handler<Http2ClientPush> handler) {
526+
public HttpClientStream pushHandler(Handler<HttpClientPush> handler) {
528527
// No op
529528
return this;
530529
}

vertx-core/src/main/java/io/vertx/core/http/impl/Http2UpgradeClientConnection.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import io.vertx.core.buffer.Buffer;
2323
import io.vertx.core.http.*;
2424
import io.vertx.core.http.HttpVersion;
25-
import io.vertx.core.http.impl.http2.Http2ClientPush;
2625
import io.vertx.core.internal.ContextInternal;
2726
import io.vertx.core.internal.PromiseInternal;
2827
import io.vertx.core.internal.logging.Logger;
@@ -173,7 +172,7 @@ public HttpClientStream earlyHintsHandler(Handler<MultiMap> handler) {
173172
}
174173

175174
@Override
176-
public HttpClientStream pushHandler(Handler<Http2ClientPush> handler) {
175+
public HttpClientStream pushHandler(Handler<HttpClientPush> handler) {
177176
delegate.pushHandler(handler);
178177
return this;
179178
}
@@ -351,7 +350,7 @@ void handleUpgrade(HttpClientConnection conn, HttpClientStream stream) {
351350
private Handler<Void> drainHandler;
352351
private Handler<Void> continueHandler;
353352
private Handler<MultiMap> earlyHintsHandler;
354-
private Handler<Http2ClientPush> pushHandler;
353+
private Handler<HttpClientPush> pushHandler;
355354
private Handler<HttpFrame> unknownFrameHandler;
356355
private Handler<Void> closeHandler;
357356

@@ -476,7 +475,7 @@ public HttpClientStream earlyHintsHandler(Handler<MultiMap> handler) {
476475
}
477476

478477
@Override
479-
public HttpClientStream pushHandler(Handler<Http2ClientPush> handler) {
478+
public HttpClientStream pushHandler(Handler<HttpClientPush> handler) {
480479
if (upgradedStream != null) {
481480
upgradedStream.pushHandler(handler);
482481
} else {

vertx-core/src/main/java/io/vertx/core/http/impl/http2/Http2ClientPush.java renamed to vertx-core/src/main/java/io/vertx/core/http/impl/HttpClientPush.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,39 @@
88
*
99
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
1010
*/
11-
package io.vertx.core.http.impl.http2;
11+
package io.vertx.core.http.impl;
1212

1313
import io.vertx.core.MultiMap;
1414
import io.vertx.core.http.HttpMethod;
15-
import io.vertx.core.http.impl.HttpClientStream;
1615
import io.vertx.core.net.HostAndPort;
1716
import io.vertx.core.net.SocketAddress;
1817
import io.vertx.core.spi.observability.HttpRequest;
1918

2019
/**
2120
* @author <a href="mailto:[email protected]">Julien Viet</a>
2221
*/
23-
public class Http2ClientPush implements HttpRequest {
22+
public class HttpClientPush implements HttpRequest {
2423

2524
private final String uri;
2625
private final HttpMethod method;
2726
private final HostAndPort authority;
2827
private final HttpClientStream stream;
2928
private final MultiMap headers;
3029

31-
Http2ClientPush(Http2HeadersMultiMap headers, HttpClientStream stream) {
30+
public HttpClientPush(HttpRequestHead head, HttpClientStream stream) {
3231

33-
String rawMethod = headers.method().toString();
34-
String authority = headers.authority() != null ? headers.authority().toString() : null;
32+
String rawMethod = head.method().toString();
33+
String authority = head.authority != null ? head.authority.toString() : null;
3534
int pos = authority == null ? -1 : authority.indexOf(':');
3635
if (pos == -1) {
3736
this.authority = HostAndPort.create(authority, 80);
3837
} else {
3938
this.authority = HostAndPort.create(authority.substring(0, pos), Integer.parseInt(authority.substring(pos + 1)));
4039
}
4140
this.method = HttpMethod.valueOf(rawMethod);
42-
this.uri = headers.path().toString();
41+
this.uri = head.uri;
4342
this.stream = stream;
44-
this.headers = headers;
43+
this.headers = head.headers;
4544
}
4645

4746
public HttpClientStream stream() {
@@ -77,4 +76,5 @@ public String uri() {
7776
public HttpMethod method() {
7877
return method;
7978
}
79+
8080
}

vertx-core/src/main/java/io/vertx/core/http/impl/HttpClientRequestBase.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import io.vertx.core.Handler;
1717
import io.vertx.core.Promise;
1818
import io.vertx.core.http.*;
19-
import io.vertx.core.http.impl.http2.Http2ClientPush;
2019
import io.vertx.core.internal.ContextInternal;
2120
import io.vertx.core.impl.NoStackTraceTimeoutException;
2221
import io.vertx.core.internal.PromiseInternal;
@@ -160,7 +159,7 @@ void fail(Throwable t) {
160159
}
161160
}
162161

163-
void handlePush(Http2ClientPush push) {
162+
void handlePush(HttpClientPush push) {
164163
HttpClientRequestPushPromise pushReq = new HttpClientRequestPushPromise(connection, push.stream(), push.method(), push.uri(), push.headers());
165164
if (pushHandler != null) {
166165
pushHandler.handle(pushReq);

vertx-core/src/main/java/io/vertx/core/http/impl/HttpClientStream.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import io.vertx.core.Handler;
1616
import io.vertx.core.MultiMap;
1717
import io.vertx.core.buffer.Buffer;
18-
import io.vertx.core.http.impl.http2.Http2ClientPush;
1918
import io.vertx.core.http.*;
2019

2120
/**
@@ -34,7 +33,7 @@ public interface HttpClientStream extends HttpStream {
3433
HttpClientStream exceptionHandler(Handler<Throwable> handler);
3534
HttpClientStream continueHandler(Handler<Void> handler);
3635
HttpClientStream earlyHintsHandler(Handler<MultiMap> handler);
37-
HttpClientStream pushHandler(Handler<Http2ClientPush> handler);
36+
HttpClientStream pushHandler(Handler<HttpClientPush> handler);
3837
HttpClientStream customFrameHandler(Handler<HttpFrame> handler);
3938
HttpClientStream dataHandler(Handler<Buffer> handler);
4039
HttpClientStream trailersHandler(Handler<MultiMap> handler);

vertx-core/src/main/java/io/vertx/core/http/impl/StatisticsGatheringHttpClientStream.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import io.vertx.core.http.HttpFrame;
2020
import io.vertx.core.http.HttpVersion;
2121
import io.vertx.core.http.StreamPriority;
22-
import io.vertx.core.http.impl.http2.Http2ClientPush;
2322
import io.vertx.core.internal.ContextInternal;
2423
import io.vertx.core.net.endpoint.ServerInteraction;
2524

@@ -103,7 +102,7 @@ public HttpClientStream earlyHintsHandler(Handler<MultiMap> handler) {
103102
}
104103

105104
@Override
106-
public HttpClientStream pushHandler(Handler<Http2ClientPush> handler) {
105+
public HttpClientStream pushHandler(Handler<HttpClientPush> handler) {
107106
delegate.pushHandler(handler);
108107
return this;
109108
}

vertx-core/src/main/java/io/vertx/core/http/impl/http2/Http2ClientStream.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import io.vertx.core.http.HttpConnection;
2323
import io.vertx.core.http.HttpHeaders;
2424
import io.vertx.core.http.HttpMethod;
25-
import io.vertx.core.http.HttpVersion;
2625
import io.vertx.core.http.StreamPriority;
2726
import io.vertx.core.http.impl.*;
2827
import io.vertx.core.http.impl.headers.HeadersMultiMap;
@@ -61,7 +60,7 @@ public class Http2ClientStream extends Http2StreamBase<Http2ClientStream> implem
6160
// Handlers
6261
private Handler<HttpResponseHead> headersHandler;
6362
private Handler<Void> continueHandler;
64-
private Handler<Http2ClientPush> pushHandler;
63+
private Handler<HttpClientPush> pushHandler;
6564
private Handler<MultiMap> earlyHintsHandler;
6665

6766
public Http2ClientStream(Http2ClientConnection connection, ContextInternal context, TracingPolicy tracingPolicy,
@@ -184,7 +183,7 @@ public Http2ClientConnection connection() {
184183
}
185184

186185
public void onPush(Http2ClientStream pushStream, int promisedStreamId, Http2HeadersMultiMap headers, boolean writable) {
187-
Http2ClientPush push = new Http2ClientPush(headers, pushStream);
186+
HttpClientPush push = new HttpClientPush(new HttpRequestHead(headers.method(), headers.path(), headers, headers.authority(), null, null), pushStream);
188187
pushStream.init(promisedStreamId, writable);
189188
if (clientMetrics != null) {
190189
Object metric = clientMetrics.requestBegin(headers.path().toString(), push);
@@ -260,13 +259,13 @@ void handleContinue() {
260259
}
261260
}
262261

263-
public Http2ClientStream pushHandler(Handler<Http2ClientPush> handler) {
262+
public Http2ClientStream pushHandler(Handler<HttpClientPush> handler) {
264263
pushHandler = handler;
265264
return this;
266265
}
267266

268-
void handlePush(Http2ClientPush push) {
269-
Handler<Http2ClientPush> handler = pushHandler;
267+
void handlePush(HttpClientPush push) {
268+
Handler<HttpClientPush> handler = pushHandler;
270269
if (handler != null) {
271270
context.dispatch(push, handler);
272271
}

0 commit comments

Comments
 (0)