io.vertx.reactivex.ext.web.client.HttpResponse.statusMessage()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中io.vertx.reactivex.ext.web.client.HttpResponse.statusMessage()方法的一些代码示例,展示了HttpResponse.statusMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpResponse.statusMessage()方法的具体详情如下:
包路径:io.vertx.reactivex.ext.web.client.HttpResponse
类名称:HttpResponse
方法名:statusMessage

HttpResponse.statusMessage介绍

暂无

代码示例

代码示例来源:origin: nemtech/nem2-sdk-java

static JsonObject mapJsonObjectOrError(final HttpResponse<JsonObject> response) {
  if (response.statusCode() < 200 || response.statusCode() > 299) {
    throw new RuntimeException(response.statusMessage());
  }
  return response.body();
}

代码示例来源:origin: nemtech/nem2-sdk-java

static JsonArray mapJsonArrayOrError(final HttpResponse<JsonArray> response) {
    if (response.statusCode() < 200 || response.statusCode() > 299) {
      throw new RuntimeException(response.statusMessage());
    }
    return response.body();
  }
}

代码示例来源:origin: FroMage/redpipe

StringBuilder message = new StringBuilder()
    .append("Could not get access token: ")
    .append(response.statusMessage());
JsonObject body = response.body();
if (body != null) {

代码示例来源:origin: FroMage/redpipe

StringBuilder message = new StringBuilder()
    .append("Could not get access token: ")
    .append(response.statusMessage());
JsonObject body = response.body();
if (body != null) {

代码示例来源:origin: io.gravitee.am.identityprovider/gravitee-am-identityprovider-oauth2-generic

private Maybe<String> authenticate(Authentication authentication) {
  // prepare body request parameters
  List<NameValuePair> urlParameters = new ArrayList<>();
  urlParameters.add(new BasicNameValuePair(CLIENT_ID, configuration.getClientId()));
  urlParameters.add(new BasicNameValuePair(CLIENT_SECRET, configuration.getClientSecret()));
  urlParameters.add(new BasicNameValuePair(REDIRECT_URI, (String) authentication.getAdditionalInformation().get(REDIRECT_URI)));
  urlParameters.add(new BasicNameValuePair(CODE, (String) authentication.getCredentials()));
  urlParameters.add(new BasicNameValuePair(GRANT_TYPE, "authorization_code"));
  String bodyRequest = URLEncodedUtils.format(urlParameters);
  return client.postAbs(configuration.getAccessTokenUri())
      .putHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(bodyRequest.length()))
      .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED)
      .rxSendBuffer(Buffer.buffer(bodyRequest))
      .toMaybe()
      .map(httpResponse -> {
        if (httpResponse.statusCode() != 200) {
          throw new BadCredentialsException(httpResponse.statusMessage());
        }
        return httpResponse.bodyAsJsonObject().getString("access_token");
      });
}

代码示例来源:origin: gravitee-io/graviteeio-access-management

private Maybe<String> authenticate(Authentication authentication) {
  // prepare body request parameters
  List<NameValuePair> urlParameters = new ArrayList<>();
  urlParameters.add(new BasicNameValuePair(CLIENT_ID, configuration.getClientId()));
  urlParameters.add(new BasicNameValuePair(CLIENT_SECRET, configuration.getClientSecret()));
  urlParameters.add(new BasicNameValuePair(REDIRECT_URI, (String) authentication.getAdditionalInformation().get(REDIRECT_URI)));
  urlParameters.add(new BasicNameValuePair(CODE, (String) authentication.getCredentials()));
  urlParameters.add(new BasicNameValuePair(GRANT_TYPE, "authorization_code"));
  String bodyRequest = URLEncodedUtils.format(urlParameters);
  return client.postAbs(configuration.getAccessTokenUri())
      .putHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(bodyRequest.length()))
      .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED)
      .rxSendBuffer(Buffer.buffer(bodyRequest))
      .toMaybe()
      .map(httpResponse -> {
        if (httpResponse.statusCode() != 200) {
          throw new BadCredentialsException(httpResponse.statusMessage());
        }
        return httpResponse.bodyAsJsonObject().getString("access_token");
      });
}

代码示例来源:origin: FroMage/redpipe

StringBuilder message = new StringBuilder()
    .append("Could not backup the wiki: ")
    .append(response.statusMessage());
JsonObject body = response.body();
if (body != null) {

代码示例来源:origin: FroMage/redpipe

StringBuilder message = new StringBuilder()
    .append("Could not backup the wiki: ")
    .append(response.statusMessage());
JsonObject body = response.body();
if (body != null) {

代码示例来源:origin: io.gravitee.am.identityprovider/gravitee-am-identityprovider-github

private Maybe<String> authenticate(Authentication authentication) {
  // prepare body request parameters
  List<NameValuePair> urlParameters = new ArrayList<>();
  urlParameters.add(new BasicNameValuePair(CLIENT_ID, configuration.getClientId()));
  urlParameters.add(new BasicNameValuePair(CLIENT_SECRET, configuration.getClientSecret()));
  urlParameters.add(new BasicNameValuePair(REDIRECT_URI, (String) authentication.getAdditionalInformation().get(REDIRECT_URI)));
  urlParameters.add(new BasicNameValuePair(CODE, (String) authentication.getCredentials()));
  String bodyRequest = URLEncodedUtils.format(urlParameters);
  return client.postAbs(configuration.getAccessTokenUri())
      .putHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(bodyRequest.length()))
      .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED)
      .rxSendBuffer(Buffer.buffer(bodyRequest))
      .toMaybe()
      .map(httpResponse -> {
        if (httpResponse.statusCode() != 200) {
          throw new BadCredentialsException(httpResponse.statusMessage());
        }
        Map<String, String> bodyResponse = URLEncodedUtils.format(httpResponse.bodyAsString());
        return bodyResponse.get("access_token");
      });
}

代码示例来源:origin: gravitee-io/graviteeio-access-management

private Maybe<String> authenticate(Authentication authentication) {
  // prepare body request parameters
  List<NameValuePair> urlParameters = new ArrayList<>();
  urlParameters.add(new BasicNameValuePair(CLIENT_ID, configuration.getClientId()));
  urlParameters.add(new BasicNameValuePair(CLIENT_SECRET, configuration.getClientSecret()));
  urlParameters.add(new BasicNameValuePair(REDIRECT_URI, (String) authentication.getAdditionalInformation().get(REDIRECT_URI)));
  urlParameters.add(new BasicNameValuePair(CODE, (String) authentication.getCredentials()));
  String bodyRequest = URLEncodedUtils.format(urlParameters);
  return client.postAbs(configuration.getAccessTokenUri())
      .putHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(bodyRequest.length()))
      .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED)
      .rxSendBuffer(Buffer.buffer(bodyRequest))
      .toMaybe()
      .map(httpResponse -> {
        if (httpResponse.statusCode() != 200) {
          throw new BadCredentialsException(httpResponse.statusMessage());
        }
        Map<String, String> bodyResponse = URLEncodedUtils.format(httpResponse.bodyAsString());
        return bodyResponse.get("access_token");
      });
}

代码示例来源:origin: io.gravitee.am.identityprovider/gravitee-am-identityprovider-oauth2-generic

private Maybe<User> profile(String accessToken) {
  return client.getAbs(configuration.getUserProfileUri())
      .putHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken)
      .rxSend()
      .toMaybe()
      .map(httpClientResponse -> {
        if (httpClientResponse.statusCode() != 200) {
          throw new BadCredentialsException(httpClientResponse.statusMessage());
        }
        return createUser(httpClientResponse.bodyAsJsonObject());
      });
}

代码示例来源:origin: io.gravitee.am.identityprovider/gravitee-am-identityprovider-github

private Maybe<User> profile(String accessToken) {
  return client.getAbs(configuration.getUserProfileUri())
      .putHeader(HttpHeaders.AUTHORIZATION, "token " + accessToken)
      .rxSend()
      .toMaybe()
      .map(httpClientResponse -> {
        if (httpClientResponse.statusCode() != 200) {
          throw new BadCredentialsException(httpClientResponse.statusMessage());
        }
        return createUser(httpClientResponse.bodyAsJsonObject());
      });
}

代码示例来源:origin: gravitee-io/graviteeio-access-management

private Maybe<User> profile(String accessToken) {
  return client.getAbs(configuration.getUserProfileUri())
      .putHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken)
      .rxSend()
      .toMaybe()
      .map(httpClientResponse -> {
        if (httpClientResponse.statusCode() != 200) {
          throw new BadCredentialsException(httpClientResponse.statusMessage());
        }
        return createUser(httpClientResponse.bodyAsJsonObject());
      });
}

代码示例来源:origin: gravitee-io/graviteeio-access-management

private Maybe<User> profile(String accessToken) {
  return client.getAbs(configuration.getUserProfileUri())
      .putHeader(HttpHeaders.AUTHORIZATION, "token " + accessToken)
      .rxSend()
      .toMaybe()
      .map(httpClientResponse -> {
        if (httpClientResponse.statusCode() != 200) {
          throw new BadCredentialsException(httpClientResponse.statusMessage());
        }
        return createUser(httpClientResponse.bodyAsJsonObject());
      });
}

相关文章