io.apiman.gateway.engine.beans.Api.getEndpointProperties()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(110)

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

Api.getEndpointProperties介绍

暂无

代码示例

代码示例来源:origin: apiman/apiman

/**
 * If the endpoint properties includes a read timeout override, then
 * set it here.
 * @param connection
 */
private void setReadTimeout(HttpURLConnection connection) {
  try {
    Map<String, String> endpointProperties = this.api.getEndpointProperties();
    if (endpointProperties.containsKey("timeouts.read")) { //$NON-NLS-1$
      int connectTimeoutMs = new Integer(endpointProperties.get("timeouts.read")); //$NON-NLS-1$
      connection.setReadTimeout(connectTimeoutMs);
    }
  } catch (Throwable t) {
  }
}

代码示例来源:origin: io.apiman/apiman-gateway-platforms-servlet

/**
 * If the endpoint properties includes a connect timeout override, then
 * set it here.
 * @param connection
 */
private void setConnectTimeout(HttpURLConnection connection) {
  try {
    Map<String, String> endpointProperties = this.api.getEndpointProperties();
    if (endpointProperties.containsKey("timeouts.connect")) { //$NON-NLS-1$
      int connectTimeoutMs = new Integer(endpointProperties.get("timeouts.connect")); //$NON-NLS-1$
      connection.setConnectTimeout(connectTimeoutMs);
    }
  } catch (Throwable t) {
  }
}

代码示例来源:origin: apiman/apiman

/**
 * If the endpoint properties includes a connect timeout override, then
 * set it here.
 * @param connection
 */
private void setConnectTimeout(HttpURLConnection connection) {
  try {
    Map<String, String> endpointProperties = this.api.getEndpointProperties();
    if (endpointProperties.containsKey("timeouts.connect")) { //$NON-NLS-1$
      int connectTimeoutMs = new Integer(endpointProperties.get("timeouts.connect")); //$NON-NLS-1$
      connection.setConnectTimeout(connectTimeoutMs);
    }
  } catch (Throwable t) {
  }
}

代码示例来源:origin: io.apiman/apiman-gateway-platforms-servlet

/**
 * If the endpoint properties includes a read timeout override, then
 * set it here.
 * @param connection
 */
private void setReadTimeout(HttpURLConnection connection) {
  try {
    Map<String, String> endpointProperties = this.api.getEndpointProperties();
    if (endpointProperties.containsKey("timeouts.read")) { //$NON-NLS-1$
      int connectTimeoutMs = new Integer(endpointProperties.get("timeouts.read")); //$NON-NLS-1$
      connection.setReadTimeout(connectTimeoutMs);
    }
  } catch (Throwable t) {
  }
}

代码示例来源:origin: apiman/apiman

/**
   * Parse API endpoint properties to retrieve enum value (if any)
   *
   * @param api the API
   * @return the required auth type
   */
  public static RequiredAuthType parseType(Api api) {
    return RequiredAuthType.fromValue(api.getEndpointProperties().get(
        RequiredAuthType.ENDPOINT_AUTHORIZATION_TYPE));
  }
}

代码示例来源:origin: io.apiman/apiman-gateway-engine-core

/**
   * Parse API endpoint properties to retrieve enum value (if any)
   *
   * @param api the API
   * @return the required auth type
   */
  public static RequiredAuthType parseType(Api api) {
    return RequiredAuthType.fromValue(api.getEndpointProperties().get(
        RequiredAuthType.ENDPOINT_AUTHORIZATION_TYPE));
  }
}

代码示例来源:origin: apiman/apiman

/**
 * If the endpoint properties includes a read timeout override, then
 * set it here.
 * @param connection
 */
private void setAttributesFromApiEndpointProperties(Api api, ApimanHttpConnectorOptions options) {
  try {
    Map<String, String> endpointProperties = api.getEndpointProperties();
    if (endpointProperties.containsKey("timeouts.read")) { //$NON-NLS-1$
      int connectTimeoutMs = Integer.parseInt(endpointProperties.get("timeouts.read")); //$NON-NLS-1$
      options.setRequestTimeout(connectTimeoutMs);
    }
    if (endpointProperties.containsKey("timeouts.connect")) { //$NON-NLS-1$
      int connectTimeoutMs = Integer.parseInt(endpointProperties.get("timeouts.connect")); //$NON-NLS-1$
      options.setConnectionTimeout(connectTimeoutMs);
    }
  } catch (NumberFormatException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: apiman/apiman

/**
 * Response API property replacements
 */
protected void resolvePropertyReplacements(Api api) {
  if (api == null) {
    return;
  }
  String endpoint = api.getEndpoint();
  endpoint = resolveProperties(endpoint);
  api.setEndpoint(endpoint);
  Map<String, String> properties = api.getEndpointProperties();
  for (Entry<String, String> entry : properties.entrySet()) {
    String value = entry.getValue();
    value = resolveProperties(value);
    entry.setValue(value);
  }
  resolvePropertyReplacements(api.getApiPolicies());
}

代码示例来源:origin: io.apiman/apiman-gateway-engine-core

/**
 * Response API property replacements
 */
protected void resolvePropertyReplacements(Api api) {
  if (api == null) {
    return;
  }
  String endpoint = api.getEndpoint();
  endpoint = resolveProperties(endpoint);
  api.setEndpoint(endpoint);
  Map<String, String> properties = api.getEndpointProperties();
  for (Entry<String, String> entry : properties.entrySet()) {
    String value = entry.getValue();
    value = resolveProperties(value);
    entry.setValue(value);
  }
  resolvePropertyReplacements(api.getApiPolicies());
}

代码示例来源:origin: io.apiman/apiman-gateway-engine-core

@Override
  public void handle(IAsyncResult<Api> result) {
    if (result.isSuccess()) {
      Api api = result.getResult();
      if (api != null) {
        List<Policy> policies = api.getApiPolicies();
        decryptPolicies(organizationId, apiId, apiVersion, EntityType.Api, policies);
        decryptEndpointProperties(organizationId, apiId, apiVersion, EntityType.Api, api.getEndpointProperties());
      }
    }
    handler.handle(result);
  }
});

代码示例来源:origin: apiman/apiman

BasicAuthOptions options = new BasicAuthOptions(api.getEndpointProperties());
if (options.getUsername() != null && options.getPassword() != null) {
  if (options.isRequireSSL() && !isSsl) {

代码示例来源:origin: apiman/apiman

@Override
  public void handle(IAsyncResult<Api> result) {
    if (result.isSuccess()) {
      Api api = result.getResult();
      if (api != null) {
        List<Policy> policies = api.getApiPolicies();
        decryptPolicies(organizationId, apiId, apiVersion, EntityType.Api, policies);
        decryptEndpointProperties(organizationId, apiId, apiVersion, EntityType.Api, api.getEndpointProperties());
      }
    }
    handler.handle(result);
  }
});

代码示例来源:origin: io.apiman/apiman-gateway-platforms-servlet

BasicAuthOptions options = new BasicAuthOptions(api.getEndpointProperties());
if (options.getUsername() != null && options.getPassword() != null) {
  if (options.isRequireSSL() && !isSsl) {

代码示例来源:origin: apiman/apiman

private void verifyConnection() {
  switch (options.getRequiredAuthType()) {
  case BASIC:
    basicOptions = new BasicAuthOptions(api.getEndpointProperties());
    if (!options.isSsl() && basicOptions.isRequireSSL())
      throw new ConnectorException("Endpoint security requested (BASIC auth) but endpoint is not secure (SSL).");
    break;
  case MTLS:
    if (!options.isSsl())
      throw new ConnectorException("Mutual TLS specified, but endpoint is not HTTPS.");
    break;
  case DEFAULT:
    break;
  }
}

代码示例来源:origin: apiman/apiman

/**
 * @see io.apiman.gateway.engine.IRegistry#publishApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
 */
@Override
public void publishApi(Api api, IAsyncResultHandler<Void> handler) {
  List<Policy> policies = api.getApiPolicies();
  encryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
  encryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
  delegate.publishApi(api, handler);
  decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
  decryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
}

代码示例来源:origin: io.apiman/apiman-gateway-engine-core

/**
 * @see io.apiman.gateway.engine.IRegistry#publishApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
 */
@Override
public void publishApi(Api api, IAsyncResultHandler<Void> handler) {
  List<Policy> policies = api.getApiPolicies();
  encryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
  encryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
  delegate.publishApi(api, handler);
  decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
  decryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
}

代码示例来源:origin: apiman/apiman

@Override
  public void handle(IAsyncResult<ApiContract> result) {
    if (result.isSuccess()) {
      ApiContract contract = result.getResult();
      List<Policy> policies = contract.getPolicies();
      decryptPolicies(contract.getClient().getOrganizationId(),
          contract.getClient().getClientId(), contract.getClient().getVersion(),
          EntityType.ClientApp, policies);
      Api api = contract.getApi();
      if (api != null) {
        List<Policy> apiPolicies = api.getApiPolicies();
        decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(),
            EntityType.Api, apiPolicies);
        decryptEndpointProperties(api.getOrganizationId(), api.getApiId(),
            api.getVersion(), EntityType.Api, api.getEndpointProperties());
      }
    }
    handler.handle(result);
  }
});

代码示例来源:origin: io.apiman/apiman-gateway-engine-core

@Override
  public void handle(IAsyncResult<ApiContract> result) {
    if (result.isSuccess()) {
      ApiContract contract = result.getResult();
      List<Policy> policies = contract.getPolicies();
      decryptPolicies(contract.getClient().getOrganizationId(),
          contract.getClient().getClientId(), contract.getClient().getVersion(),
          EntityType.ClientApp, policies);
      Api api = contract.getApi();
      if (api != null) {
        List<Policy> apiPolicies = api.getApiPolicies();
        decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(),
            EntityType.Api, apiPolicies);
        decryptEndpointProperties(api.getOrganizationId(), api.getApiId(),
            api.getVersion(), EntityType.Api, api.getEndpointProperties());
      }
    }
    handler.handle(result);
  }
});

相关文章