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


Java HttpRequest.send方法代码示例

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


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

示例1: testImplicitMode

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
public void testImplicitMode() {
    vertx = Vertx.vertx();
    WebClient client = WebClient.create(vertx);
    HttpRequest<Buffer> request = client.postAbs("http://admin:[email protected]:8080/oauth/authorize?response_type=token&scope=read%20write&client_id=myClientId&redirect_uri=http://example.com");
    request.putHeader("Authorization", getHeader());
    request.send(ar -> {
        if (ar.succeeded()) {
            HttpResponse<Buffer> response = ar.result();
            //String location = response.getHeader("Location");
            String body = response.bodyAsString();
            System.out.println("Implicit Mode Get Token" + body + " status code" + response.statusCode() + " Location=");
        } else {
            System.out.println("Something went wrong " + ar.cause().getMessage());
        }
    });
}
 
开发者ID:openmg,项目名称:metagraph-auth,代码行数:17,代码来源:VertxWebTest.java

示例2: renewSelf

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Renews the current token.
 *
 * @param leaseDurationInSecond the extension in second
 * @param resultHandler         the callback invoked with the result
 */
public void renewSelf(long leaseDurationInSecond, Handler<AsyncResult<Auth>> resultHandler) {
  JsonObject payload = null;
  if (leaseDurationInSecond > 0) {
    payload = new JsonObject().put("increment", leaseDurationInSecond);
  }
  HttpRequest<Buffer> request = client.post("/v1/auth/token/renew-self")
    .putHeader(TOKEN_HEADER, Objects.requireNonNull(getToken(), "The token must not be null"));

  Handler<AsyncResult<HttpResponse<Buffer>>> handler = ar -> {
    if (ar.failed()) {
      resultHandler.handle(VaultException.toFailure("Unable to access the Vault", ar.cause()));
      return;
    }
    manageAuthResult(resultHandler, ar.result());
  };

  if (payload != null) {
    request.sendJsonObject(payload, handler);
  } else {
    request.send(handler);
  }
}
 
开发者ID:vert-x3,项目名称:vertx-config,代码行数:29,代码来源:SlimVaultClient.java

示例3: cookieFormNoexplodeArray

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Call cookie_form_noexplode_array with empty body.
 * @param color Parameter color inside cookie
 * @param handler The handler for the asynchronous request
 */
public void cookieFormNoexplodeArray(
    List<Object> color,
    Handler<AsyncResult<HttpResponse>> handler) {
    // Check required params
    if (color == null) throw new RuntimeException("Missing parameter color");


    // Generate the uri
    String uri = "/cookie/form/noexplode/array";

    HttpRequest request = client.get(uri);

    MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap();
    if (color != null) this.renderCookieArrayForm("color", color, requestCookies);


    this.renderAndAttachCookieHeader(request, requestCookies);
    request.send(handler);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:25,代码来源:ApiClient.java

示例4: headerSimpleNoexplodeString

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Call header_simple_noexplode_string with empty body.
 * @param color Parameter color inside header
 * @param handler The handler for the asynchronous request
 */
public void headerSimpleNoexplodeString(
    String color,
    Handler<AsyncResult<HttpResponse>> handler) {
    // Check required params
    if (color == null) throw new RuntimeException("Missing parameter color");


    // Generate the uri
    String uri = "/header/simple/noexplode/string";

    HttpRequest request = client.get(uri);

    MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap();
    if (color != null) this.addHeaderParam("color", color, request);


    this.renderAndAttachCookieHeader(request, requestCookies);
    request.send(handler);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:25,代码来源:ApiClient.java

示例5: cookieFormNoexplodeString

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Call cookie_form_noexplode_string with empty body.
 * @param color Parameter color inside cookie
 * @param handler The handler for the asynchronous request
 */
public void cookieFormNoexplodeString(
    String color,
    Handler<AsyncResult<HttpResponse>> handler) {
    // Check required params
    if (color == null) throw new RuntimeException("Missing parameter color");


    // Generate the uri
    String uri = "/cookie/form/noexplode/string";

    HttpRequest request = client.get(uri);

    MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap();
    if (color != null) this.renderCookieParam("color", color, requestCookies);


    this.renderAndAttachCookieHeader(request, requestCookies);
    request.send(handler);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:25,代码来源:ApiClient.java

示例6: headerSimpleExplodeString

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Call header_simple_explode_string with empty body.
 * @param color Parameter color inside header
 * @param handler The handler for the asynchronous request
 */
public void headerSimpleExplodeString(
    String color,
    Handler<AsyncResult<HttpResponse>> handler) {
    // Check required params
    if (color == null) throw new RuntimeException("Missing parameter color");


    // Generate the uri
    String uri = "/header/simple/explode/string";

    HttpRequest request = client.get(uri);

    MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap();
    if (color != null) this.addHeaderParam("color", color, request);


    this.renderAndAttachCookieHeader(request, requestCookies);
    request.send(handler);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:25,代码来源:ApiClient.java

示例7: queryFormNoexplodeArray

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Call query_form_noexplode_array with empty body.
 * @param color Parameter color inside query
 * @param handler The handler for the asynchronous request
 */
public void queryFormNoexplodeArray(
    List<Object> color,
    Handler<AsyncResult<HttpResponse>> handler) {
    // Check required params
    if (color == null) throw new RuntimeException("Missing parameter color");


    // Generate the uri
    String uri = "/query/form/noexplode/array";

    HttpRequest request = client.get(uri);

    MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap();
    if (color != null) this.addQueryArrayForm("color", color, request);


    this.renderAndAttachCookieHeader(request, requestCookies);
    request.send(handler);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:25,代码来源:ApiClient.java

示例8: pathMultiSimpleMatrix

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Call path_multi_simple_matrix with empty body.
 * @param colorSimple Parameter color_simple inside path
 * @param colorMatrix Parameter color_matrix inside path
 * @param handler The handler for the asynchronous request
 */
public void pathMultiSimpleMatrix(
    String colorSimple,
    List<Object> colorMatrix,
    Handler<AsyncResult<HttpResponse>> handler) {
    // Check required params
    if (colorSimple == null) throw new RuntimeException("Missing parameter colorSimple in path");
    if (colorMatrix == null) throw new RuntimeException("Missing parameter colorMatrix in path");


    // Generate the uri
    String uri = "/path/multi/{color_simple}{;color_matrix}/test";
    uri = uri.replaceAll("\\{{1}([.;?*+]*([^\\{\\}.;?*+]+)[^\\}]*)\\}{1}", "{$2}"); //Remove * . ; ? from url template
    uri = uri.replace("{color_simple}", this.renderPathParam("color_simple", colorSimple));
    uri = uri.replace("{color_matrix}", this.renderPathArrayMatrix("color_matrix", colorMatrix));


    HttpRequest request = client.get(uri);

    MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap();


    this.renderAndAttachCookieHeader(request, requestCookies);
    request.send(handler);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:31,代码来源:ApiClient.java

示例9: headerSimpleExplodeArray

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Call header_simple_explode_array with empty body.
 * @param color Parameter color inside header
 * @param handler The handler for the asynchronous request
 */
public void headerSimpleExplodeArray(
    List<Object> color,
    Handler<AsyncResult<HttpResponse>> handler) {
    // Check required params
    if (color == null) throw new RuntimeException("Missing parameter color");


    // Generate the uri
    String uri = "/header/simple/explode/array";

    HttpRequest request = client.get(uri);

    MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap();
    if (color != null) this.addHeaderArraySimpleExplode("color", color, request);


    this.renderAndAttachCookieHeader(request, requestCookies);
    request.send(handler);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:25,代码来源:ApiClient.java

示例10: pathMultiLabelMatrix

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Call path_multi_label_matrix with empty body.
 * @param colorLabel Parameter color_label inside path
 * @param colorMatrix Parameter color_matrix inside path
 * @param handler The handler for the asynchronous request
 */
public void pathMultiLabelMatrix(
    List<Object> colorLabel,
    Map<String, Object> colorMatrix,
    Handler<AsyncResult<HttpResponse>> handler) {
    // Check required params
    if (colorLabel == null) throw new RuntimeException("Missing parameter colorLabel in path");
    if (colorMatrix == null) throw new RuntimeException("Missing parameter colorMatrix in path");


    // Generate the uri
    String uri = "/path/multi/{.color_label}{;color_matrix*}/test";
    uri = uri.replaceAll("\\{{1}([.;?*+]*([^\\{\\}.;?*+]+)[^\\}]*)\\}{1}", "{$2}"); //Remove * . ; ? from url template
    uri = uri.replace("{color_label}", this.renderPathArrayLabel("color_label", colorLabel));
    uri = uri.replace("{color_matrix}", this.renderPathObjectMatrixExplode("color_matrix", colorMatrix));


    HttpRequest request = client.get(uri);

    MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap();


    this.renderAndAttachCookieHeader(request, requestCookies);
    request.send(handler);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:31,代码来源:ApiClient.java

示例11: queryPipeDelimitedNoexplodeObject

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Call query_pipeDelimited_noexplode_object with empty body.
 * @param color Parameter color inside query
 * @param handler The handler for the asynchronous request
 */
public void queryPipeDelimitedNoexplodeObject(
    Map<String, Object> color,
    Handler<AsyncResult<HttpResponse>> handler) {
    // Check required params
    if (color == null) throw new RuntimeException("Missing parameter color");


    // Generate the uri
    String uri = "/query/pipeDelimited/noexplode/object";

    HttpRequest request = client.get(uri);

    MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap();
    if (color != null) this.addQueryObjectPipeDelimited("color", color, request);


    this.renderAndAttachCookieHeader(request, requestCookies);
    request.send(handler);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:25,代码来源:ApiClient.java

示例12: queryDeepObjectExplodeObject

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Call query_deepObject_explode_object with empty body.
 * @param color Parameter color inside query
 * @param handler The handler for the asynchronous request
 */
public void queryDeepObjectExplodeObject(
    Map<String, Object> color,
    Handler<AsyncResult<HttpResponse>> handler) {
    // Check required params
    if (color == null) throw new RuntimeException("Missing parameter color");


    // Generate the uri
    String uri = "/query/deepObject/explode/object";

    HttpRequest request = client.get(uri);

    MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap();
    if (color != null) this.addQueryObjectDeepObjectExplode("color", color, request);


    this.renderAndAttachCookieHeader(request, requestCookies);
    request.send(handler);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:25,代码来源:ApiClient.java

示例13: headerSimpleNoexplodeArray

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Call header_simple_noexplode_array with empty body.
 * @param color Parameter color inside header
 * @param handler The handler for the asynchronous request
 */
public void headerSimpleNoexplodeArray(
    List<Object> color,
    Handler<AsyncResult<HttpResponse>> handler) {
    // Check required params
    if (color == null) throw new RuntimeException("Missing parameter color");


    // Generate the uri
    String uri = "/header/simple/noexplode/array";

    HttpRequest request = client.get(uri);

    MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap();
    if (color != null) this.addHeaderArraySimple("color", color, request);


    this.renderAndAttachCookieHeader(request, requestCookies);
    request.send(handler);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:25,代码来源:ApiClient.java

示例14: cookieFormExplodeArray

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Call cookie_form_explode_array with empty body.
 * @param color Parameter color inside cookie
 * @param handler The handler for the asynchronous request
 */
public void cookieFormExplodeArray(
    List<Object> color,
    Handler<AsyncResult<HttpResponse>> handler) {
    // Check required params
    if (color == null) throw new RuntimeException("Missing parameter color");


    // Generate the uri
    String uri = "/cookie/form/explode/array";

    HttpRequest request = client.get(uri);

    MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap();
    if (color != null) this.renderCookieArrayFormExplode("color", color, requestCookies);


    this.renderAndAttachCookieHeader(request, requestCookies);
    request.send(handler);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:25,代码来源:ApiClient.java

示例15: queryFormNoexplodeObject

import io.vertx.ext.web.client.HttpRequest; //导入方法依赖的package包/类
/**
 * Call query_form_noexplode_object with empty body.
 * @param color Parameter color inside query
 * @param handler The handler for the asynchronous request
 */
public void queryFormNoexplodeObject(
    Map<String, Object> color,
    Handler<AsyncResult<HttpResponse>> handler) {
    // Check required params
    if (color == null) throw new RuntimeException("Missing parameter color");


    // Generate the uri
    String uri = "/query/form/noexplode/object";

    HttpRequest request = client.get(uri);

    MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap();
    if (color != null) this.addQueryObjectForm("color", color, request);


    this.renderAndAttachCookieHeader(request, requestCookies);
    request.send(handler);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:25,代码来源:ApiClient.java


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