当前位置: 首页>>代码示例>>Java>>正文


Java WebClient.get方法代码示例

本文整理汇总了Java中io.vertx.ext.web.client.WebClient.get方法的典型用法代码示例。如果您正苦于以下问题:Java WebClient.get方法的具体用法?Java WebClient.get怎么用?Java WebClient.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.ext.web.client.WebClient的用法示例。


在下文中一共展示了WebClient.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test

import io.vertx.ext.web.client.WebClient; //导入方法依赖的package包/类
@Test
	public void test(TestContext context) throws InterruptedException {
//		Async async = context.async();
		Vertx vertx = rule.vertx();

		WebClient client = WebClient.create(vertx);
		HttpRequest<Buffer> req = client.get(41414, "172.21.9.21", "/metrics");
		req.putHeader("aa","ccc");
		 
		req.timeout(50000);
		req.send(ar -> {
			if (ar.succeeded()) {

				HttpResponse<Buffer> response = ar.result();
				System.out.println(response.body());
				System.out.println("Received response with status code" + response.statusCode());
			} else {
				System.out.println("Something went wrong " + ar.cause().getMessage());
			}
//			async.complete();

		});

	
		System.out.println("here1");
//		async.awaitSuccess();
	}
 
开发者ID:troopson,项目名称:etagate,代码行数:28,代码来源:TestFutureFail.java

示例2: simpleGetWithInitialParams

import io.vertx.ext.web.client.WebClient; //导入方法依赖的package包/类
public void simpleGetWithInitialParams(WebClient client) {
  HttpRequest<Buffer> request = client.get(8080, "myserver.mycompany.com", "/some-uri?param1=param1_value&param2=param2_value");

  // Add param3
  request.addQueryParam("param3", "param3_value");

  // Overwrite param2
  request.setQueryParam("param2", "another_param2_value");
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:10,代码来源:WebClientExamples.java

示例3: simpleGetOverwritePreviousParams

import io.vertx.ext.web.client.WebClient; //导入方法依赖的package包/类
public void simpleGetOverwritePreviousParams(WebClient client) {
  HttpRequest<Buffer> request = client.get(8080, "myserver.mycompany.com", "/some-uri");

  // Add param1
  request.addQueryParam("param1", "param1_value");

  // Overwrite param1 and add param2
  request.uri("/some-uri?param1=param1_value&param2=param2_value");
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:10,代码来源:WebClientExamples.java

示例4: multiGet

import io.vertx.ext.web.client.WebClient; //导入方法依赖的package包/类
public void multiGet(WebClient client) {
  HttpRequest<Buffer> get = client.get(8080, "myserver.mycompany.com", "/some-uri");
  get.send(ar -> {
    if (ar.succeeded()) {
      // Ok
    }
  });

  // Same request again
  get.send(ar -> {
    if (ar.succeeded()) {
      // Ok
    }
  });
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:16,代码来源:WebClientExamples.java

示例5: multiGetCopy

import io.vertx.ext.web.client.WebClient; //导入方法依赖的package包/类
public void multiGetCopy(WebClient client) {
  HttpRequest<Buffer> get = client.get(8080, "myserver.mycompany.com", "/some-uri");
  get.send(ar -> {
    if (ar.succeeded()) {
      // Ok
    }
  });

  // The "get" request instance remains unmodified
  get.copy().putHeader("a-header", "with-some-value").send(ar -> {
    if (ar.succeeded()) {
      // Ok
    }
  });
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:16,代码来源:WebClientExamples.java

示例6: sendHeaders1

import io.vertx.ext.web.client.WebClient; //导入方法依赖的package包/类
public void sendHeaders1(WebClient client) {
  HttpRequest<Buffer> request = client.get(8080, "myserver.mycompany.com", "/some-uri");
  MultiMap headers = request.headers();
  headers.set("content-type", "application/json");
  headers.set("other-header", "foo");
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:7,代码来源:WebClientExamples.java

示例7: sendHeaders2

import io.vertx.ext.web.client.WebClient; //导入方法依赖的package包/类
public void sendHeaders2(WebClient client) {
  HttpRequest<Buffer> request = client.get(8080, "myserver.mycompany.com", "/some-uri");
  request.putHeader("content-type", "application/json");
  request.putHeader("other-header", "foo");
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:6,代码来源:WebClientExamples.java


注:本文中的io.vertx.ext.web.client.WebClient.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。