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

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

本文整理了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

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

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

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

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

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

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

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

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

  1. /**
  2. * Parse API endpoint properties to retrieve enum value (if any)
  3. *
  4. * @param api the API
  5. * @return the required auth type
  6. */
  7. public static RequiredAuthType parseType(Api api) {
  8. return RequiredAuthType.fromValue(api.getEndpointProperties().get(
  9. RequiredAuthType.ENDPOINT_AUTHORIZATION_TYPE));
  10. }
  11. }

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

  1. /**
  2. * Parse API endpoint properties to retrieve enum value (if any)
  3. *
  4. * @param api the API
  5. * @return the required auth type
  6. */
  7. public static RequiredAuthType parseType(Api api) {
  8. return RequiredAuthType.fromValue(api.getEndpointProperties().get(
  9. RequiredAuthType.ENDPOINT_AUTHORIZATION_TYPE));
  10. }
  11. }

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

  1. /**
  2. * If the endpoint properties includes a read timeout override, then
  3. * set it here.
  4. * @param connection
  5. */
  6. private void setAttributesFromApiEndpointProperties(Api api, ApimanHttpConnectorOptions options) {
  7. try {
  8. Map<String, String> endpointProperties = api.getEndpointProperties();
  9. if (endpointProperties.containsKey("timeouts.read")) { //$NON-NLS-1$
  10. int connectTimeoutMs = Integer.parseInt(endpointProperties.get("timeouts.read")); //$NON-NLS-1$
  11. options.setRequestTimeout(connectTimeoutMs);
  12. }
  13. if (endpointProperties.containsKey("timeouts.connect")) { //$NON-NLS-1$
  14. int connectTimeoutMs = Integer.parseInt(endpointProperties.get("timeouts.connect")); //$NON-NLS-1$
  15. options.setConnectionTimeout(connectTimeoutMs);
  16. }
  17. } catch (NumberFormatException e) {
  18. throw new RuntimeException(e);
  19. }
  20. }

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

  1. /**
  2. * Response API property replacements
  3. */
  4. protected void resolvePropertyReplacements(Api api) {
  5. if (api == null) {
  6. return;
  7. }
  8. String endpoint = api.getEndpoint();
  9. endpoint = resolveProperties(endpoint);
  10. api.setEndpoint(endpoint);
  11. Map<String, String> properties = api.getEndpointProperties();
  12. for (Entry<String, String> entry : properties.entrySet()) {
  13. String value = entry.getValue();
  14. value = resolveProperties(value);
  15. entry.setValue(value);
  16. }
  17. resolvePropertyReplacements(api.getApiPolicies());
  18. }

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

  1. /**
  2. * Response API property replacements
  3. */
  4. protected void resolvePropertyReplacements(Api api) {
  5. if (api == null) {
  6. return;
  7. }
  8. String endpoint = api.getEndpoint();
  9. endpoint = resolveProperties(endpoint);
  10. api.setEndpoint(endpoint);
  11. Map<String, String> properties = api.getEndpointProperties();
  12. for (Entry<String, String> entry : properties.entrySet()) {
  13. String value = entry.getValue();
  14. value = resolveProperties(value);
  15. entry.setValue(value);
  16. }
  17. resolvePropertyReplacements(api.getApiPolicies());
  18. }

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

  1. @Override
  2. public void handle(IAsyncResult<Api> result) {
  3. if (result.isSuccess()) {
  4. Api api = result.getResult();
  5. if (api != null) {
  6. List<Policy> policies = api.getApiPolicies();
  7. decryptPolicies(organizationId, apiId, apiVersion, EntityType.Api, policies);
  8. decryptEndpointProperties(organizationId, apiId, apiVersion, EntityType.Api, api.getEndpointProperties());
  9. }
  10. }
  11. handler.handle(result);
  12. }
  13. });

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

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

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

  1. @Override
  2. public void handle(IAsyncResult<Api> result) {
  3. if (result.isSuccess()) {
  4. Api api = result.getResult();
  5. if (api != null) {
  6. List<Policy> policies = api.getApiPolicies();
  7. decryptPolicies(organizationId, apiId, apiVersion, EntityType.Api, policies);
  8. decryptEndpointProperties(organizationId, apiId, apiVersion, EntityType.Api, api.getEndpointProperties());
  9. }
  10. }
  11. handler.handle(result);
  12. }
  13. });

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

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

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

  1. private void verifyConnection() {
  2. switch (options.getRequiredAuthType()) {
  3. case BASIC:
  4. basicOptions = new BasicAuthOptions(api.getEndpointProperties());
  5. if (!options.isSsl() && basicOptions.isRequireSSL())
  6. throw new ConnectorException("Endpoint security requested (BASIC auth) but endpoint is not secure (SSL).");
  7. break;
  8. case MTLS:
  9. if (!options.isSsl())
  10. throw new ConnectorException("Mutual TLS specified, but endpoint is not HTTPS.");
  11. break;
  12. case DEFAULT:
  13. break;
  14. }
  15. }

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

  1. /**
  2. * @see io.apiman.gateway.engine.IRegistry#publishApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
  3. */
  4. @Override
  5. public void publishApi(Api api, IAsyncResultHandler<Void> handler) {
  6. List<Policy> policies = api.getApiPolicies();
  7. encryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
  8. encryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
  9. delegate.publishApi(api, handler);
  10. decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
  11. decryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
  12. }

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

  1. /**
  2. * @see io.apiman.gateway.engine.IRegistry#publishApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
  3. */
  4. @Override
  5. public void publishApi(Api api, IAsyncResultHandler<Void> handler) {
  6. List<Policy> policies = api.getApiPolicies();
  7. encryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
  8. encryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
  9. delegate.publishApi(api, handler);
  10. decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, policies);
  11. decryptEndpointProperties(api.getOrganizationId(), api.getApiId(), api.getVersion(), EntityType.Api, api.getEndpointProperties());
  12. }

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

  1. @Override
  2. public void handle(IAsyncResult<ApiContract> result) {
  3. if (result.isSuccess()) {
  4. ApiContract contract = result.getResult();
  5. List<Policy> policies = contract.getPolicies();
  6. decryptPolicies(contract.getClient().getOrganizationId(),
  7. contract.getClient().getClientId(), contract.getClient().getVersion(),
  8. EntityType.ClientApp, policies);
  9. Api api = contract.getApi();
  10. if (api != null) {
  11. List<Policy> apiPolicies = api.getApiPolicies();
  12. decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(),
  13. EntityType.Api, apiPolicies);
  14. decryptEndpointProperties(api.getOrganizationId(), api.getApiId(),
  15. api.getVersion(), EntityType.Api, api.getEndpointProperties());
  16. }
  17. }
  18. handler.handle(result);
  19. }
  20. });

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

  1. @Override
  2. public void handle(IAsyncResult<ApiContract> result) {
  3. if (result.isSuccess()) {
  4. ApiContract contract = result.getResult();
  5. List<Policy> policies = contract.getPolicies();
  6. decryptPolicies(contract.getClient().getOrganizationId(),
  7. contract.getClient().getClientId(), contract.getClient().getVersion(),
  8. EntityType.ClientApp, policies);
  9. Api api = contract.getApi();
  10. if (api != null) {
  11. List<Policy> apiPolicies = api.getApiPolicies();
  12. decryptPolicies(api.getOrganizationId(), api.getApiId(), api.getVersion(),
  13. EntityType.Api, apiPolicies);
  14. decryptEndpointProperties(api.getOrganizationId(), api.getApiId(),
  15. api.getVersion(), EntityType.Api, api.getEndpointProperties());
  16. }
  17. }
  18. handler.handle(result);
  19. }
  20. });

相关文章