-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation of an HTTP client connection API.
- Loading branch information
Showing
28 changed files
with
675 additions
and
404 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
src/main/generated/io/vertx/core/http/HttpConnectOptionsConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package io.vertx.core.http; | ||
|
||
import io.vertx.core.json.JsonObject; | ||
import io.vertx.core.json.JsonArray; | ||
import io.vertx.core.json.impl.JsonUtil; | ||
import java.time.Instant; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.Base64; | ||
|
||
/** | ||
* Converter and mapper for {@link io.vertx.core.http.HttpConnectOptions}. | ||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.http.HttpConnectOptions} original class using Vert.x codegen. | ||
*/ | ||
public class HttpConnectOptionsConverter { | ||
|
||
|
||
private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER; | ||
private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER; | ||
|
||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, HttpConnectOptions obj) { | ||
for (java.util.Map.Entry<String, Object> member : json) { | ||
switch (member.getKey()) { | ||
case "proxyOptions": | ||
if (member.getValue() instanceof JsonObject) { | ||
obj.setProxyOptions(new io.vertx.core.net.ProxyOptions((io.vertx.core.json.JsonObject)member.getValue())); | ||
} | ||
break; | ||
case "host": | ||
if (member.getValue() instanceof String) { | ||
obj.setHost((String)member.getValue()); | ||
} | ||
break; | ||
case "port": | ||
if (member.getValue() instanceof Number) { | ||
obj.setPort(((Number)member.getValue()).intValue()); | ||
} | ||
break; | ||
case "ssl": | ||
if (member.getValue() instanceof Boolean) { | ||
obj.setSsl((Boolean)member.getValue()); | ||
} | ||
break; | ||
case "sslOptions": | ||
if (member.getValue() instanceof JsonObject) { | ||
obj.setSslOptions(new io.vertx.core.net.ClientSSLOptions((io.vertx.core.json.JsonObject)member.getValue())); | ||
} | ||
break; | ||
case "connectTimeout": | ||
if (member.getValue() instanceof Number) { | ||
obj.setConnectTimeout(((Number)member.getValue()).longValue()); | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
|
||
static void toJson(HttpConnectOptions obj, JsonObject json) { | ||
toJson(obj, json.getMap()); | ||
} | ||
|
||
static void toJson(HttpConnectOptions obj, java.util.Map<String, Object> json) { | ||
if (obj.getProxyOptions() != null) { | ||
json.put("proxyOptions", obj.getProxyOptions().toJson()); | ||
} | ||
if (obj.getHost() != null) { | ||
json.put("host", obj.getHost()); | ||
} | ||
if (obj.getPort() != null) { | ||
json.put("port", obj.getPort()); | ||
} | ||
if (obj.isSsl() != null) { | ||
json.put("ssl", obj.isSsl()); | ||
} | ||
if (obj.getSslOptions() != null) { | ||
json.put("sslOptions", obj.getSslOptions().toJson()); | ||
} | ||
json.put("connectTimeout", obj.getConnectTimeout()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/io/vertx/core/http/HttpClientConnection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2011-2024 Contributors to the Eclipse Foundation | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
*/ | ||
package io.vertx.core.http; | ||
|
||
import io.vertx.codegen.annotations.VertxGen; | ||
import io.vertx.core.Future; | ||
|
||
/** | ||
* Represents an HTTP client connection. | ||
* | ||
* @author <a href="mailto:[email protected]">Julien Viet</a> | ||
*/ | ||
@VertxGen | ||
public interface HttpClientConnection extends HttpConnection { | ||
|
||
/** | ||
* Like {@link #createRequest(RequestOptions)} but with null options. | ||
*/ | ||
Future<HttpClientRequest> createRequest(); | ||
|
||
/** | ||
* Create an HTTP request initialized with the specified request {@code options} | ||
* | ||
* This enqueues a request in the client connection queue, the resulting future is notified when the connection can satisfy | ||
* the request. | ||
* | ||
* Pooled HTTP connection will return an error, since requests should be made against the pool instead the connection itself. | ||
* | ||
* @return a future notified with the created request | ||
*/ | ||
Future<HttpClientRequest> createRequest(RequestOptions options); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.