本文整理了Java中io.vertx.ext.web.client.WebClient.wrap()
方法的一些代码示例,展示了WebClient.wrap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebClient.wrap()
方法的具体详情如下:
包路径:io.vertx.ext.web.client.WebClient
类名称:WebClient
方法名:wrap
暂无
代码示例来源:origin: vert-x3/vertx-rx
/**
* Wrap an <code>httpClient</code> with a web client and default options.
* <p>
* Only the specific web client portion of the <code>options</code> is used, the {@link io.vertx.core.http.HttpClientOptions}
* of the <code>httpClient</code> is reused.
* @param httpClient the to wrap
* @param options the Web Client options
* @return the web client
*/
public static io.vertx.rxjava.ext.web.client.WebClient wrap(io.vertx.rxjava.core.http.HttpClient httpClient, WebClientOptions options) {
io.vertx.rxjava.ext.web.client.WebClient ret = io.vertx.rxjava.ext.web.client.WebClient.newInstance(io.vertx.ext.web.client.WebClient.wrap(httpClient.getDelegate(), options));
return ret;
}
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Wrap an <code>httpClient</code> with a web client and default options.
* @param httpClient the to wrap
* @return the web client
*/
public static io.vertx.rxjava.ext.web.client.WebClient wrap(io.vertx.rxjava.core.http.HttpClient httpClient) {
io.vertx.rxjava.ext.web.client.WebClient ret = io.vertx.rxjava.ext.web.client.WebClient.newInstance(io.vertx.ext.web.client.WebClient.wrap(httpClient.getDelegate()));
return ret;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Wrap an <code>httpClient</code> with a web client and default options.
* @param httpClient the to wrap
* @return the web client
*/
public static io.vertx.rxjava.ext.web.client.WebClient wrap(io.vertx.rxjava.core.http.HttpClient httpClient) {
io.vertx.rxjava.ext.web.client.WebClient ret = io.vertx.rxjava.ext.web.client.WebClient.newInstance(io.vertx.ext.web.client.WebClient.wrap(httpClient.getDelegate()));
return ret;
}
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Wrap an <code>httpClient</code> with a web client and default options.
* <p>
* Only the specific web client portion of the <code>options</code> is used, the {@link io.vertx.core.http.HttpClientOptions}
* of the <code>httpClient</code> is reused.
* @param httpClient the to wrap
* @param options the Web Client options
* @return the web client
*/
public static io.vertx.rxjava.ext.web.client.WebClient wrap(io.vertx.rxjava.core.http.HttpClient httpClient, WebClientOptions options) {
io.vertx.rxjava.ext.web.client.WebClient ret = io.vertx.rxjava.ext.web.client.WebClient.newInstance(io.vertx.ext.web.client.WebClient.wrap(httpClient.getDelegate(), options));
return ret;
}
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static io.vertx.ext.web.client.WebClient wrap(io.vertx.ext.web.client.WebClient j_receiver, io.vertx.core.http.HttpClient httpClient, java.util.Map<String, Object> options) {
return io.vertx.core.impl.ConversionHelper.fromObject(io.vertx.ext.web.client.WebClient.wrap(httpClient,
options != null ? new io.vertx.ext.web.client.WebClientOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(options)) : null));
}
}
代码示例来源:origin: vert-x3/vertx-service-discovery
} else if (x.getName().contains("WebClient")) {
WebClient client = WebClient.wrap((HttpClient) svc);
if (x.isInstance(client)) {
retrieved = client;
代码示例来源:origin: io.vertx/vertx-service-discovery
} else if (x.getName().contains("WebClient")) {
WebClient client = WebClient.wrap((HttpClient) svc);
if (x.isInstance(client)) {
retrieved = client;
代码示例来源:origin: EliMirren/VX-API-Gateway
/**
* 实例化一个session_token的授权处理器
*
* @param option
* @param apis
* @param httpClient
* @throws NullPointerException
* @throws MalformedURLException
*/
public SessionTokenGrantAuthHandler(JsonObject option, VxApis apis, HttpClient httpClient)
throws NullPointerException, MalformedURLException {
if (option.getValue("saveTokenName") instanceof String) {
this.saveTokenName = option.getString("saveTokenName");
}
if (option.getValue("getTokenName") instanceof String) {
this.getTokenName = option.getString("getTokenName");
}
if (option.getValue("isNext") instanceof Boolean) {
this.isNext = option.getBoolean("isNext");
}
this.thisVertxName = System.getProperty("thisVertxName", "VX-API");
webClient = WebClient.wrap(httpClient);
this.api = apis;
this.serOptions = VxApiServerEntranceHttpOptions.fromJson(apis.getServerEntrance().getBody());
checkVxApiParamOptions(serOptions);
this.policy = new VxApiServerURLPollingPolicy(serOptions.getServerUrls());
}
代码示例来源:origin: io.vertx/vertx-web-client
private WebClient buildPlainWebClient() {
HttpClient vc = vertx.createHttpClient(new HttpClientOptions().setDefaultPort(PORT).setDefaultHost("localhost"));
return WebClient.wrap(vc);
}
代码示例来源:origin: io.vertx/vertx-web-client
@Test
public void testCustomUserAgent() throws Exception {
client = WebClient.wrap(super.client, new WebClientOptions().setUserAgent("smith"));
testRequest(client -> client.get("somehost", "somepath"), req -> assertEquals(Collections.singletonList("smith"), req.headers().getAll(HttpHeaders.USER_AGENT)));
}
代码示例来源:origin: io.vertx/vertx-web-client
@Test
public void testUserAgentDisabled() throws Exception {
client = WebClient.wrap(super.client, new WebClientOptions().setUserAgentEnabled(false));
testRequest(client -> client.get("somehost", "somepath"), req -> assertEquals(Collections.emptyList(), req.headers().getAll(HttpHeaders.USER_AGENT)));
}
代码示例来源:origin: io.vertx/vertx-service-discovery
.toJson());
WebClient webClient = WebClient.wrap(reference.get());
webClient.get("/get").as(BodyCodec.jsonObject()).send(testContext.asyncAssertSuccess(resp -> {
assertEquals("https://127.0.0.1:" + server.actualPort() + "/get", resp.body().getString("url"));
代码示例来源:origin: io.vertx/vertx-web-client
@Override
public void setUp() throws Exception {
super.setUp();
super.client = vertx.createHttpClient(new HttpClientOptions().setDefaultPort(8080).setDefaultHost("localhost"));
client = (WebClientInternal) WebClient.wrap(super.client);
server.close();
server = vertx.createHttpServer(new HttpServerOptions().setPort(DEFAULT_HTTP_PORT).setHost(DEFAULT_HTTP_HOST));
}
代码示例来源:origin: vert-x3/vertx-service-discovery
.toJson());
WebClient webClient = WebClient.wrap(reference.get());
webClient.get("/get").as(BodyCodec.jsonObject()).send(testContext.asyncAssertSuccess(resp -> {
assertEquals("https://127.0.0.1:" + server.actualPort() + "/get", resp.body().getString("url"));
代码示例来源:origin: io.vertx/vertx-web-client
@Override
public void setUp() throws Exception {
super.setUp();
super.client = vertx.createHttpClient(new HttpClientOptions().setDefaultPort(8080).setDefaultHost("localhost"));
client = WebClient.wrap(super.client);
server.close();
server = vertx.createHttpServer(new HttpServerOptions().setPort(DEFAULT_HTTP_PORT).setHost(DEFAULT_HTTP_HOST));
testFile = testFolder.newFile("test.txt");
}
内容来源于网络,如有侵权,请联系作者删除!