/** * Returns an URI for the given endpoint. * Prefixes the protocol if the endpoint given does not have it. * * @throws IllegalArgumentException if the inputs are null. */ public static URI toUri(String endpoint, ClientConfiguration config) { if (config == null) { throw new IllegalArgumentException("ClientConfiguration cannot be null"); } return toUri(endpoint, config.getProtocol()); }
/** * Returns the Java system property for proxy user name depending on * {@link #getProtocol()}: i.e. if protocol is https, returns * the value of the system property https.proxyUser, otherwise * returns value of http.proxyUser. */ private String getProxyUsernameProperty() { return (getProtocol() == Protocol.HTTPS) ? getSystemProperty("https.proxyUser") : getSystemProperty("http.proxyUser"); }
/** * Returns the Java system property for proxy host depending on * {@link #getProtocol()}: i.e. if protocol is https, returns * the value of the system property https.proxyHost, otherwise * returns value of http.proxyHost. */ private String getProxyHostProperty() { return getProtocol() == Protocol.HTTPS ? getSystemProperty("https.proxyHost") : getSystemProperty("http.proxyHost"); }
/** * Returns the Java system property for proxy password depending on * {@link #getProtocol()}: i.e. if protocol is https, returns * the value of the system property https.proxyPassword, otherwise * returns value of http.proxyPassword. */ private String getProxyPasswordProperty() { return (getProtocol() == Protocol.HTTPS) ? getSystemProperty("https.proxyPassword") : getSystemProperty("http.proxyPassword"); }
/** * Returns the Java system property for proxy port depending on * {@link #getProtocol()}: i.e. if protocol is https, returns * the value of the system property https.proxyPort, otherwise * returns value of http.proxyPort. Defaults to {@link this.proxyPort} * if the system property is not set with a valid port number. */ private int getProxyPortProperty() { final String proxyPortString = (getProtocol() == Protocol.HTTPS) ? getSystemProperty("https.proxyPort") : getSystemProperty("http.proxyPort"); try { return Integer.parseInt(proxyPortString); } catch (NumberFormatException e) { return proxyPort; } }
private URI getCreateBucketEndpoint(String requestRegion) { // Route to the default endpoint if they're not trying to specify a different one in the request. if(requestRegion == null || requestRegion.equals(clientRegion) || !clientOptions.isForceGlobalBucketAccessEnabled()) { return endpoint; } // If they enabled global bucket access and they're trying to create a bucket in a region different than the default // one specified when they created the client, it will probably fail because only us-east-1 (actually the global // endpoint) is capable of creating buckets outside of its region. Override the endpoint to which the request // is routed so that it will succeed. com.amazonaws.regions.Region targetRegion = com.amazonaws.regions.Region.getRegion(Regions.fromName(requestRegion)); return new DefaultServiceEndpointBuilder(getEndpointPrefix(), clientConfiguration.getProtocol().toString()).withRegion(targetRegion) .getServiceEndpoint(); }
URI uri = new DefaultServiceEndpointBuilder(serviceNameForEndpoint, clientConfiguration.getProtocol() .toString()).withRegion(region).getServiceEndpoint(); Signer signer = computeSignerByServiceRegion(serviceNameForSigner, region.getName(), signerRegionOverride, false);
/** * Returns an URI for the given endpoint. * Prefixes the protocol if the endpoint given does not have it. * * @throws IllegalArgumentException if the inputs are null. */ public static URI toUri(String endpoint, ClientConfiguration config) { if (config == null) { throw new IllegalArgumentException("ClientConfiguration cannot be null"); } return toUri(endpoint, config.getProtocol()); }
/** * @param endpoint the endpoint. * @param config the client configuration. * @return an URI for the given endpoint. Prefixes the protocol if the * endpoint given does not have it. * * @throws IllegalArgumentException if the inputs are null. */ public static URI toUri(String endpoint, ClientConfiguration config) { if (config == null) { throw new IllegalArgumentException("ClientConfiguration cannot be null"); } return toUri(endpoint, config.getProtocol()); }
/** * @param endpoint the endpoint. * @return the endpoint as a URI. */ @SuppressWarnings({"checkstyle:finalparameters", "checkstyle:hiddenfield"}) private URI toURI(String endpoint) { /* * If the endpoint doesn't explicitly specify a protocol to use, then * we'll defer to the default protocol specified in the client * configuration. */ if (!endpoint.contains("://")) { endpoint = clientConfiguration.getProtocol().toString() + "://" + endpoint; } try { return new URI(endpoint); } catch (final URISyntaxException e) { throw new IllegalArgumentException(e); } }
this.throttleRetries = other.useThrottledRetries(); this.localAddress = other.getLocalAddress(); this.protocol = other.getProtocol(); this.proxyProtocol = other.getProxyProtocol(); this.proxyDomain = other.getProxyDomain();
/** * Returns the Java system property for proxy user name depending on * {@link #getProtocol()}: i.e. if protocol is https, returns * the value of the system property https.proxyUser, otherwise * returns value of http.proxyUser. */ private String getProxyUsernameProperty() { return (getProtocol() == Protocol.HTTPS) ? getSystemProperty("https.proxyUser") : getSystemProperty("http.proxyUser"); }
/** * Returns the Java system property for proxy password depending on * {@link #getProtocol()}: i.e. if protocol is https, returns * the value of the system property https.proxyPassword, otherwise * returns value of http.proxyPassword. */ private String getProxyPasswordProperty() { return (getProtocol() == Protocol.HTTPS) ? getSystemProperty("https.proxyPassword") : getSystemProperty("http.proxyPassword"); }
/** * Returns the Java system property for proxy host depending on * {@link #getProtocol()}: i.e. if protocol is https, returns * the value of the system property https.proxyHost, otherwise * returns value of http.proxyHost. */ private String getProxyHostProperty() { return getProtocol() == Protocol.HTTPS ? getSystemProperty("https.proxyHost") : getSystemProperty("http.proxyHost"); }
/** * Returns the Java system property for proxy port depending on * {@link #getProtocol()}: i.e. if protocol is https, returns * the value of the system property https.proxyPort, otherwise * returns value of http.proxyPort. Defaults to {@link this.proxyPort} * if the system property is not set with a valid port number. */ private int getProxyPortProperty() { final String proxyPortString = (getProtocol() == Protocol.HTTPS) ? getSystemProperty("https.proxyPort") : getSystemProperty("http.proxyPort"); try { return Integer.parseInt(proxyPortString); } catch (NumberFormatException e) { return proxyPort; } }
URI uri = new DefaultServiceEndpointBuilder(serviceNameForEndpoint, clientConfiguration.getProtocol() .toString()).withRegion(region).getServiceEndpoint(); Signer signer = computeSignerByServiceRegion(serviceNameForSigner, region.getName(), signerRegionOverride, false);
configuration.getProtocol(), configuration.getSignerOverride(), configuration.getConnectionTimeout(), configuration.getMaxErrorRetry(), configuration.getSocketTimeout(), clientOptions.getUseTCPKeepAlive(), clientOptions.getConnectionTtl()));
this.throttleRetries = other.useThrottledRetries(); this.localAddress = other.getLocalAddress(); this.protocol = other.getProtocol(); this.proxyProtocol = other.getProxyProtocol(); this.proxyDomain = other.getProxyDomain();
assertEquals(c.getMaxErrorRetry(), n.getMaxErrorRetry()); assertEquals(c.isPreemptiveBasicProxyAuth(), n.isPreemptiveBasicProxyAuth()); assertEquals(c.getProtocol(), n.getProtocol()); assertEquals(c.getProxyHost(), n.getProxyHost()); assertEquals(c.getProxyPassword(), n.getProxyPassword());
assertEquals(c.getProtocol(), Protocol.HTTP); c.setProtocol(Protocol.HTTPS); assertEquals(c.getProtocol(), Protocol.HTTPS);