/** * Gets an unmodeled piece of metadata. Useful for protocol specific options. * * @param key Key the metadata was registered under. * @param <T> Type of metadata being requested. * @return The value of the additional metadata being requested or null if it's not present. */ public <T> T addtionalMetadata(OperationMetadataAttribute<T> key) { return additionalMetadata.get(key); }
/** * Gets an unmodeled piece of metadata. Useful for protocol specific options. * * @param key Key the metadata was registered under. * @param <T> Type of metadata being requested. * @return The value of the additional metadata being requested or null if it's not present. */ public <T> T addtionalMetadata(OperationMetadataAttribute<T> key) { return additionalMetadata.get(key); }
/** * Load the requested advanced option that was configured on the client builder. This will return null if the value was not * configured. * * @see Builder#advancedOption(SdkAdvancedAsyncClientOption, Object) */ public <T> T advancedOption(SdkAdvancedAsyncClientOption<T> option) { return advancedOptions.get(option); }
/** * Retrieve the value of a specific option. */ public <T> T option(ClientOption<T> option) { return attributes.get(option); }
public int maxConnections() { return configuration.get(MAX_CONNECTIONS); }
public boolean trustAllCertificates() { return configuration.get(TRUST_ALL_CERTIFICATES); }
public int maxPendingConnectionAcquires() { return configuration.get(MAX_PENDING_CONNECTION_ACQUIRES); }
/** * Load the optional requested advanced option that was configured on the client builder. * * @see Builder#putAdvancedOption(SdkAdvancedClientOption, Object) */ public <T> Optional<T> advancedOption(SdkAdvancedClientOption<T> option) { return Optional.ofNullable(advancedOptions.get(option)); }
@Override public <T> Optional<T> getConfigurationValue(SdkHttpConfigurationOption<T> key) { return Optional.ofNullable(resolvedOptions.get(key)); }
private HostnameVerifier getHostNameVerifier(AttributeMap standardOptions) { return standardOptions.get(SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES) ? NoopHostnameVerifier.INSTANCE : SSLConnectionSocketFactory.getDefaultHostnameVerifier(); }
public int writeTimeoutMillis() { return saturatedCast(configuration.get(SdkHttpConfigurationOption.WRITE_TIMEOUT).toMillis()); } }
@ReviewBeforeRelease("Need to have a way to communicate with HTTP impl supports disabling of strict" + "hostname verification. If it doesn't we either need to fail in S3 or switch to path style" + "addressing.") private HostnameVerifier getHostNameVerifier(AttributeMap standardOptions) { // TODO Need to find a better way to handle these deprecations. return standardOptions.get(SdkHttpConfigurationOption.USE_STRICT_HOSTNAME_VERIFICATION) ? SSLConnectionSocketFactory.STRICT_HOSTNAME_VERIFIER : SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER; }
public int connectTimeoutMillis() { return saturatedCast(configuration.get(CONNECTION_TIMEOUT).toMillis()); }
private HttpURLConnection createDefaultConnection(URI uri) { HttpURLConnection connection = invokeSafely(() -> (HttpURLConnection) uri.toURL().openConnection()); connection.setConnectTimeout(saturatedCast(options.get(CONNECTION_TIMEOUT).toMillis())); connection.setReadTimeout(saturatedCast(options.get(READ_TIMEOUT).toMillis())); return connection; }
private ApacheHttpRequestConfig createRequestConfig(DefaultBuilder builder, AttributeMap resolvedOptions) { return ApacheHttpRequestConfig.builder() .socketTimeout(resolvedOptions.get(READ_TIMEOUT)) .connectionTimeout(resolvedOptions.get(CONNECTION_TIMEOUT)) .connectionAcquireTimeout(resolvedOptions.get(CONNECTION_ACQUIRE_TIMEOUT)) .proxyConfiguration(builder.proxyConfiguration) .localAddress(Optional.ofNullable(builder.localAddress).orElse(null)) .expectContinueEnabled(Optional.ofNullable(builder.expectContinueEnabled) .orElse(DefaultConfiguration.EXPECT_CONTINUE_ENABLED)) .build(); }
private ApacheHttpRequestConfig createRequestConfig(AttributeMap resolvedOptions) { return ApacheHttpRequestConfig.builder() .socketTimeout(resolvedOptions.get(SOCKET_TIMEOUT)) .connectionTimeout(resolvedOptions.get(CONNECTION_TIMEOUT)) .proxyConfiguration(proxyConfiguration) .localAddress(localAddress.orElse(null)) .expectContinueEnabled(expectContinueEnabled.orElse(Defaults.EXPECT_CONTINUE_ENABLED)) .build(); }
NettyNioAsyncHttpClient(DefaultBuilder builder, AttributeMap serviceDefaultsMap) { this.configuration = new NettyConfiguration(serviceDefaultsMap); this.protocol = serviceDefaultsMap.get(SdkHttpConfigurationOption.PROTOCOL); this.maxStreams = builder.maxHttp2Streams == null ? Integer.MAX_VALUE : builder.maxHttp2Streams; this.sdkEventLoopGroup = eventLoopGroup(builder); this.pools = createChannelPoolMap(); this.sdkChannelOptions = channelOptions(builder); }
NettyNioAsyncHttpClient(DefaultBuilder builder, AttributeMap serviceDefaultsMap) { this.configuration = new NettyConfiguration(serviceDefaultsMap); this.protocol = serviceDefaultsMap.get(SdkHttpConfigurationOption.PROTOCOL); this.maxStreams = builder.maxHttp2Streams == null ? MAX_STREAMS_ALLOWED : builder.maxHttp2Streams; this.sdkEventLoopGroup = eventLoopGroup(builder); this.pools = createChannelPoolMap(); this.sdkChannelOptions = channelOptions(builder); }
private SocketConfig buildSocketConfig(AttributeMap standardOptions) { return SocketConfig.custom() // TODO do we want to keep SO keep alive .setSoKeepAlive(false) .setSoTimeout( saturatedCast(standardOptions.get(SdkHttpConfigurationOption.READ_TIMEOUT) .toMillis())) .setTcpNoDelay(true) .build(); }
private SocketConfig buildSocketConfig(AttributeMap standardOptions) { return SocketConfig.custom() // TODO do we want to keep SO keep alive .setSoKeepAlive(false) .setSoTimeout( saturatedCast(standardOptions.get(SdkHttpConfigurationOption.SOCKET_TIMEOUT).toMillis())) .setTcpNoDelay(true) .build(); }