本文整理了Java中io.vertx.ext.web.client.HttpResponse.statusMessage()
方法的一些代码示例,展示了HttpResponse.statusMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpResponse.statusMessage()
方法的具体详情如下:
包路径:io.vertx.ext.web.client.HttpResponse
类名称:HttpResponse
方法名:statusMessage
暂无
代码示例来源:origin: vert-x3/vertx-examples
private void invoke(RoutingContext rc) {
client.get("/luke").as(BodyCodec.string()).send(ar -> {
if (ar.failed()) {
rc.response().end("Unable to call the greeting service: " + ar.cause().getMessage());
} else {
if (ar.result().statusCode() != 200) {
rc.response().end("Unable to call the greeting service - received status:" + ar.result().statusMessage());
} else {
rc.response().end("Greeting service invoked: '" + ar.result().body() + "'");
}
}
});
}
}
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* @return the status message of the response
*/
public String statusMessage() {
if (cached_2 != null) {
return cached_2;
}
String ret = delegate.statusMessage();
cached_2 = ret;
return ret;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* @return the status message of the response
*/
public String statusMessage() {
if (cached_2 != null) {
return cached_2;
}
String ret = delegate.statusMessage();
cached_2 = ret;
return ret;
}
代码示例来源:origin: vert-x3/vertx-config
private void manageAuthResult(Handler<AsyncResult<Auth>> resultHandler, HttpResponse<Buffer> response) {
if (response.statusCode() != 200) {
resultHandler.handle(VaultException.toFailure(response.statusMessage(), response.statusCode(),
response.bodyAsString()));
} else {
JsonObject object = response.bodyAsJsonObject();
Auth auth = object.getJsonObject("auth").mapTo(Auth.class);
resultHandler.handle(Future.succeededFuture(auth));
}
}
代码示例来源:origin: io.vertx/vertx-consul-client
resultHandler.handle(Future.failedFuture(resp.statusMessage()));
代码示例来源:origin: vert-x3/vertx-config
/**
* Deletes a secret from `path`.
*
* @param path the path
* @param resultHandler the callback invoked with the result
*/
public void delete(String path, Handler<AsyncResult<Void>> resultHandler) {
Objects.requireNonNull(resultHandler);
client.delete("/v1/" + Objects.requireNonNull(path))
.putHeader(TOKEN_HEADER, Objects.requireNonNull(getToken(), "The token must be set"))
.send(ar -> {
if (ar.failed()) {
resultHandler.handle(VaultException.toFailure("Unable to access the Vault", ar.cause()));
return;
}
HttpResponse<Buffer> response = ar.result();
if (response.statusCode() != 204) {
resultHandler.handle(VaultException.toFailure(response.statusMessage(), response.statusCode(),
response.bodyAsString()));
} else {
resultHandler.handle(Future.succeededFuture());
}
});
}
代码示例来源:origin: vert-x3/vertx-config
/**
* Reads a secret from `path`.
*
* @param path the path
* @param responseHandler the callback invoked with the result
*/
public void read(String path, Handler<AsyncResult<Secret>> responseHandler) {
Objects.requireNonNull(responseHandler);
client.get("/v1/" + Objects.requireNonNull(path))
.putHeader(TOKEN_HEADER, Objects.requireNonNull(getToken(), "No token to access the vault"))
.send(response -> {
if (response.failed()) {
responseHandler.handle(VaultException.toFailure("Unable to access the Vault", response.cause()));
return;
}
HttpResponse<Buffer> result = response.result();
if (result.statusCode() != 200) {
responseHandler.handle(VaultException.toFailure(result.statusMessage(), result.statusCode(),
result.bodyAsString()));
} else {
Secret secret = result.bodyAsJson(Secret.class);
responseHandler.handle(Future.succeededFuture(secret));
}
});
}
代码示例来源:origin: vert-x3/vertx-config
/**
* Write a secret to `path`.
*
* @param path the path
* @param resultHandler the callback invoked with the result
*/
public void write(String path, JsonObject secrets, Handler<AsyncResult<Secret>> resultHandler) {
Objects.requireNonNull(resultHandler);
client.post("/v1/" + Objects.requireNonNull(path))
.putHeader(TOKEN_HEADER, Objects.requireNonNull(getToken(), "The token must be set"))
.sendJsonObject(Objects.requireNonNull(secrets, "The secret must be set"),
ar -> {
if (ar.failed()) {
resultHandler.handle(VaultException.toFailure("Unable to access the Vault", ar.cause()));
return;
}
HttpResponse<Buffer> response = ar.result();
if (response.statusCode() == 200 || response.statusCode() == 204) {
resultHandler.handle(Future.succeededFuture(response.bodyAsJson(Secret.class)));
} else {
resultHandler.handle(VaultException.toFailure(response.statusMessage(), response.statusCode(),
response.bodyAsString()));
}
});
}
代码示例来源:origin: cn.vertxup/vertx-up
/**
* Success ( 200 )
*/
private static void syncSuccess(
final HttpServerResponse response,
final HttpResponse<Buffer> clientResponse) {
final Buffer data = clientResponse.bodyAsBuffer();
// Copy header
syncSuccess(response,
clientResponse.headers(),
clientResponse.statusCode(),
clientResponse.statusMessage(),
data);
}
代码示例来源:origin: vert-x3/vertx-config
/**
* Looks up for the current token metadata.
*
* @param resultHandler the callback invoked with the result
*/
public void lookupSelf(Handler<AsyncResult<Lookup>> resultHandler) {
client.get("/v1/auth/token/lookup-self")
.putHeader(TOKEN_HEADER, Objects.requireNonNull(getToken(), "The token must not be null"))
.send(ar -> {
if (ar.failed()) {
resultHandler.handle(VaultException.toFailure("Unable to access the Vault", ar.cause()));
return;
}
HttpResponse<Buffer> response = ar.result();
if (response.statusCode() != 200) {
resultHandler.handle(VaultException.toFailure(response.statusMessage(), response.statusCode(),
response.bodyAsString()));
} else {
JsonObject object = response.bodyAsJsonObject();
Lookup lookup = object.getJsonObject("data").mapTo(Lookup.class);
resultHandler.handle(Future.succeededFuture(lookup));
}
});
}
代码示例来源:origin: silentbalanceyh/vertx-zero
/**
* Success ( 200 )
*/
private static void syncSuccess(
final HttpServerResponse response,
final HttpResponse<Buffer> clientResponse) {
final Buffer data = clientResponse.bodyAsBuffer();
// Copy header
syncSuccess(response,
clientResponse.headers(),
clientResponse.statusCode(),
clientResponse.statusMessage(),
data);
}
内容来源于网络,如有侵权,请联系作者删除!