/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
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)); } }
} else if (x.getName().contains("WebClient")) { WebClient client = WebClient.wrap((HttpClient) svc); if (x.isInstance(client)) { retrieved = client;
} else if (x.getName().contains("WebClient")) { WebClient client = WebClient.wrap((HttpClient) svc); if (x.isInstance(client)) { retrieved = client;
/** * 实例化一个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()); }
private WebClient buildPlainWebClient() { HttpClient vc = vertx.createHttpClient(new HttpClientOptions().setDefaultPort(PORT).setDefaultHost("localhost")); return WebClient.wrap(vc); }
@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))); }
@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))); }
.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"));
@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)); }
.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"));
@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"); }