private URI parseApiEndpoint(Api api) { try { return new URI(api.getEndpoint()); } catch (URISyntaxException e) { throw new RuntimeException(e); } }
/** * 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()); }
/** * 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()); }
/** * Constructor. * @param api * @param request * @param handler */ public PolicyTesterApiConnection(Api api, ApiRequest request, IAsyncResultHandler<IApiConnectionResponse> handler) { this.request = request; this.handler = handler; this.output = null; this.backEndApi = createBackEndApi(api.getEndpoint()); }
String endpoint = ApimanPathUtils.join(api.getEndpoint(), request.getDestination());
/** * Constructor. * @param api * @param request * @param handler */ public PolicyTesterApiConnection(Api api, ApiRequest request, IAsyncResultHandler<IApiConnectionResponse> handler) { this.request = request; this.handler = handler; this.output = null; this.backEndApi = createBackEndApi(api.getEndpoint()); }
String endpoint = ApimanPathUtils.join(api.getEndpoint(), request.getDestination());
@Override public IApiConnector createConnector(ApiRequest req, Api api, RequiredAuthType authType, boolean hasDataPolicy, IConnectorConfig connectorConfig) { return (request, resultHandler) -> { // Apply options from config as our base case ApimanHttpConnectorOptions httpOptions = new ApimanHttpConnectorOptions(config) .setHasDataPolicy(hasDataPolicy) .setRequiredAuthType(authType) .setTlsOptions(tlsOptions) .setUri(parseApiEndpoint(api)) .setSsl(api.getEndpoint().toLowerCase().startsWith("https")); //$NON-NLS-1$ // If API has endpoint properties indicating timeouts, then override config. setAttributesFromApiEndpointProperties(api, httpOptions); // Get from cache HttpClient client = clientFromCache(httpOptions); return new HttpConnector(vertx, client, request, api, httpOptions, connectorConfig, resultHandler).connect(); }; }
new ApimanHttpConnectorOptions() .setHasDataPolicy(true) .setUri(URI.create(api.getEndpoint())), new VertxConnectorConfig(), ignored -> {