io.vertx.reactivex.core.MultiMap.set()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(172)

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

MultiMap.set介绍

暂无

代码示例

代码示例来源:origin: io.gravitee.am.gateway/gravitee-am-gateway-reactor

private void sendNotFound(HttpServerResponse serverResponse) {
  // Send a NOT_FOUND HTTP status code (404)
  serverResponse.setStatusCode(HttpStatusCode.NOT_FOUND_404);
  String message = environment.getProperty("http.errors[404].message", "");
  serverResponse.headers().set(HttpHeaders.CONTENT_LENGTH, Integer.toString(message.length()));
  serverResponse.headers().set(HttpHeaders.CONTENT_TYPE, "text/plain");
  serverResponse.headers().set(HttpHeaders.CONNECTION, HttpHeadersValues.CONNECTION_CLOSE);
  serverResponse.write(Buffer.buffer(message));
  serverResponse.end();
}

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

private void sendNotFound(HttpServerResponse serverResponse) {
  // Send a NOT_FOUND HTTP status code (404)
  serverResponse.setStatusCode(HttpStatusCode.NOT_FOUND_404);
  String message = environment.getProperty("http.errors[404].message", "");
  serverResponse.headers().set(HttpHeaders.CONTENT_LENGTH, Integer.toString(message.length()));
  serverResponse.headers().set(HttpHeaders.CONTENT_TYPE, "text/plain");
  serverResponse.headers().set(HttpHeaders.CONNECTION, HttpHeadersValues.CONNECTION_CLOSE);
  serverResponse.write(Buffer.buffer(message));
  serverResponse.end();
}

代码示例来源:origin: io.knotx/knotx-core

private MultiMap buildHeaders(String hostHeader, MultiMap headers) {
 MultiMap result = filteredHeaders(headers);
 if (configuration.getCustomHttpHeader() != null) {
  result.set(
    configuration.getCustomHttpHeader().getName(),
    configuration.getCustomHttpHeader().getValue()
  );
 }
 //Overide host header if provided in client destination
 if (StringUtils.isNotBlank(hostHeader)) {
  result.set(HttpHeaderNames.HOST.toString(), hostHeader);
 }
 return result;
}

代码示例来源:origin: Cognifide/knotx

private MultiMap buildHeaders(String hostHeader, MultiMap headers) {
 MultiMap result = filteredHeaders(headers);
 if (configuration.getCustomHttpHeader() != null) {
  result.set(
    configuration.getCustomHttpHeader().getName(),
    configuration.getCustomHttpHeader().getValue()
  );
 }
 //Overide host header if provided in client destination
 if (StringUtils.isNotBlank(hostHeader)) {
  result.set(HttpHeaderNames.HOST.toString(), hostHeader);
 }
 return result;
}

代码示例来源:origin: io.knotx.acme/acme-forms-adapter-http

private void updateRequestHeaders(HttpRequest<Buffer> request, ClientRequest serviceRequest,
  HttpFormsSettings serviceMetadata) {
 MultiMap filteredHeaders = getFilteredHeaders(serviceRequest.getHeaders(),
   serviceMetadata.getAllowedRequestHeadersPatterns());
 filteredHeaders.names().forEach(
   headerName -> filteredHeaders.getAll(headerName)
     .forEach(value -> request.headers().add(headerName, value)));
 if (customHttpHeader != null) {
  request.headers().set(
    customHttpHeader.getName(),
    customHttpHeader.getValue()
  );
 }
}

代码示例来源:origin: io.knotx/knotx-databridge-adapter-http

private void updateRequestHeaders(HttpRequest<Buffer> request, ClientRequest serviceRequest,
                 HttpDataSourceSettings serviceMetadata) {
 MultiMap filteredHeaders = getFilteredHeaders(serviceRequest.getHeaders(),
   serviceMetadata.getAllowedRequestHeadersPatterns());
 filteredHeaders.names().forEach(
   headerName -> filteredHeaders.getAll(headerName)
     .forEach(value -> request.headers().add(headerName, value)));
 if (customHttpHeader != null) {
  request.headers().set(
    customHttpHeader.getName(),
    customHttpHeader.getValue()
  );
 }
}

代码示例来源:origin: Cognifide/knotx

private void updateRequestHeaders(HttpRequest<Buffer> request, ClientRequest serviceRequest,
  ServiceSettings serviceMetadata) {
 MultiMap filteredHeaders = getFilteredHeaders(serviceRequest.getHeaders(),
   serviceMetadata.getAllowedRequestHeadersPatterns());
 filteredHeaders.names().forEach(
   headerName -> filteredHeaders.getAll(headerName)
     .forEach(value -> request.headers().add(headerName, value)));
 if (customHttpHeader != null) {
  request.headers().set(
    customHttpHeader.getName(),
    customHttpHeader.getValue()
  );
 }
}

代码示例来源:origin: io.gravitee.am.gateway.handlers/gravitee-am-gateway-handler

private void parseClaimsParameter(RoutingContext context) {
  String claims = context.request().getParam(OIDCParameters.CLAIMS);
  if (claims != null) {
    try {
      ClaimsRequest claimsRequest = claimsRequestResolver.resolve(claims);
      // save claims request as json string value (will be use for id_token and/or UserInfo endpoint)
      context.request().params().set(OIDCParameters.CLAIMS, Json.encode(claimsRequest));
    } catch (ClaimsRequestSyntaxException e) {
      throw new InvalidRequestException("Invalid parameter: claims");
    }
  }
}

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

private void parseClaimsParameter(RoutingContext context) {
  String claims = context.request().getParam(OIDCParameters.CLAIMS);
  if (claims != null) {
    try {
      ClaimsRequest claimsRequest = claimsRequestResolver.resolve(claims);
      // save claims request as json string value (will be use for id_token and/or UserInfo endpoint)
      context.request().params().set(OIDCParameters.CLAIMS, Json.encode(claimsRequest));
    } catch (ClaimsRequestSyntaxException e) {
      throw new InvalidRequestException("Invalid parameter: claims");
    }
  }
}

代码示例来源:origin: io.gravitee.am.gateway.handlers/gravitee-am-gateway-handler

private void parsePKCEParameter(RoutingContext context) {
  String codeChallenge = context.request().getParam(OAuth2Constants.CODE_CHALLENGE);
  String codeChallengeMethod = context.request().getParam(OAuth2Constants.CODE_CHALLENGE_METHOD);
  if (codeChallenge == null && codeChallengeMethod != null) {
    throw new InvalidRequestException("Missing parameter: code_challenge");
  }
  if (codeChallenge == null) {
    // No code challenge provided by client
    return;
  }
  if (codeChallengeMethod != null) {
    // https://tools.ietf.org/html/rfc7636#section-4.2
    // It must be plain or S256
    if (!OAuth2Constants.PKCE_METHOD_S256.equalsIgnoreCase(codeChallengeMethod) &&
        !OAuth2Constants.PKCE_METHOD_PLAIN.equalsIgnoreCase(codeChallengeMethod)) {
      throw new InvalidRequestException("Invalid parameter: code_challenge_method");
    }
  } else {
    // https://tools.ietf.org/html/rfc7636#section-4.3
    // Default code challenge is plain
    context.request().params().set(OAuth2Constants.CODE_CHALLENGE_METHOD, OAuth2Constants.PKCE_METHOD_PLAIN);
  }
  // Check that code challenge is valid
  if (!PKCEUtils.validCodeChallenge(codeChallenge)) {
    throw new InvalidRequestException("Invalid parameter: code_challenge");
  }
}

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

private void parsePKCEParameter(RoutingContext context) {
  String codeChallenge = context.request().getParam(OAuth2Constants.CODE_CHALLENGE);
  String codeChallengeMethod = context.request().getParam(OAuth2Constants.CODE_CHALLENGE_METHOD);
  if (codeChallenge == null && codeChallengeMethod != null) {
    throw new InvalidRequestException("Missing parameter: code_challenge");
  }
  if (codeChallenge == null) {
    // No code challenge provided by client
    return;
  }
  if (codeChallengeMethod != null) {
    // https://tools.ietf.org/html/rfc7636#section-4.2
    // It must be plain or S256
    if (!OAuth2Constants.PKCE_METHOD_S256.equalsIgnoreCase(codeChallengeMethod) &&
        !OAuth2Constants.PKCE_METHOD_PLAIN.equalsIgnoreCase(codeChallengeMethod)) {
      throw new InvalidRequestException("Invalid parameter: code_challenge_method");
    }
  } else {
    // https://tools.ietf.org/html/rfc7636#section-4.3
    // Default code challenge is plain
    context.request().params().set(OAuth2Constants.CODE_CHALLENGE_METHOD, OAuth2Constants.PKCE_METHOD_PLAIN);
  }
  // Check that code challenge is valid
  if (!PKCEUtils.validCodeChallenge(codeChallenge)) {
    throw new InvalidRequestException("Invalid parameter: code_challenge");
  }
}

相关文章