public String getHost() throws MalformedURLException { return new URL( getUri() ).getHost(); }
public SiteConfig build() { return new SiteConfig( id, uri, user, proxyHost, proxyPort, proxyUser, trustType, keyCertPem, serverCertPem, requestTimeoutSeconds, connectionPoolTimeoutSeconds, maxConnections, maxPerRoute, connectionConfig, socketConfig, requestConfig, clientContextProtoype, ignoreHostnameVerification, attributes ); }
@Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( !( o instanceof SiteConnectionConfig ) ) { return false; } SiteConnectionConfig that = (SiteConnectionConfig) o; return config.equals( that.config ); }
HttpClientContext prototype = location.getClientContextPrototype(); if ( prototype != null ) RequestConfig reqConf = location.getRequestConfig(); if ( reqConf == null ) location.getConnectionPoolTimeoutSeconds() ); location.getConnectionPoolTimeoutSeconds() ) .build(); CookieStore cookieStore = (CookieStore) location.getAttribute( COOKIE_STORE ); if ( cookieStore == null ) location.setAttribute( COOKIE_STORE, cookieStore ); try as = new AuthScope( location.getHost(), location.getPort() ); e, location.getUri(), location.getId(), e.getMessage() ); if ( location.getUser() != null ) if ( location.getProxyHost() != null && location.getProxyUser() != null ) new AuthScope( location.getProxyHost(), getProxyPort( location ) ), location, PasswordType.PROXY, ctx );
SSLConnectionSocketFactory fac = (SSLConnectionSocketFactory) location.getAttribute( SSL_FACTORY_ATTRIB ); if ( fac != null ) final String kcPem = location.getKeyCertPem(); location.getUri() ); throw new JHttpCException( "Location: " + location.getUri() + " is misconfigured! Key password cannot be empty." ); location.getUri(), e.getMessage() ), e ); throw new JHttpCException( "Failed to initialize SSL connection for repository: " + location.getUri() ); location.getUri(), e.getMessage() ), e ); throw new JHttpCException( "Failed to initialize SSL connection for repository: " + location.getUri() ); location.getUri(), e.getMessage() ), e ); throw new JHttpCException( "Failed to initialize SSL connection for repository: " + location.getUri() ); location.getUri(), e.getMessage() ), e ); throw new JHttpCException( "Failed to initialize SSL connection for repository: " + location.getUri() ); final String sPem = location.getServerCertPem(); ts = SSLUtils.decodePEMTrustStore( sPem, location.getHost() ); location.getUri(), e.getMessage() ), e ); throw new JHttpCException( "Failed to initialize SSL connection for repository: " + location.getUri() ); location.getUri(), e.getMessage() ), e );
private SiteConfig toSiteConfig( RemoteRepository repository ) { SiteConfigBuilder builder = new SiteConfigBuilder( repository.getName(), repository.getUrl() ); logger.debug( "Adding server PEM to site config for: {}\n{}", repository.getKey(), repository.getServerCertPem() ); builder.withKeyCertPem( repository.getKeyCertPem() ) .withProxyHost( repository.getProxyHost() ) .withProxyPort( repository.getProxyPort() ) .withProxyUser( repository.getProxyUser() ) .withRequestTimeoutSeconds( repository.getTimeoutSeconds() ) .withServerCertPem( repository.getServerCertPem() ) .withTrustType( SiteTrustType.TRUST_SELF_SIGNED ) .withUser( repository.getUser() ); SiteConfig config = builder.build(); logger.debug( "Got server PEM in site config:\n{}", config.getServerCertPem() ); config.setAttribute( PASSWORD_PREFIX + KEY.name(), repository.getKeyPassword() ); config.setAttribute( PASSWORD_PREFIX + USER.name(), repository.getPassword() ); config.setAttribute( PASSWORD_PREFIX + PROXY.name(), repository.getProxyPassword() ); return config; }
private void set( SiteConfig loc, PasswordType type, String password ) { loc.setAttribute( PASSWORD_PREFIX + type.name(), password ); }
public <T> T getAttribute( String key, Class<T> type, T defaultValue ) { Object value = getAttribute( key ); return value == null ? defaultValue : type.cast( value ); }
public ConnectionConfig getConnectionConfig() { return config.getConnectionConfig(); }
public int getConnectionPoolTimeoutSeconds() { return config.getConnectionPoolTimeoutSeconds(); }
public <T> T getAttribute( String key, Class<T> type ) { Object value = getAttribute( key ); return value == null ? null : type.cast( value ); }
public int getPort() throws MalformedURLException { URL u = new URL( getUri() ); int port = u.getPort(); if ( port < 1 ) { port = u.getDefaultPort(); } return port; }
@Override public String lookup( final PasswordKey id ) { SiteConfig config = lookupManager.lookup( id.getSiteId() ); if ( config == null ) { return null; } return config.getAttribute( PASSWORD_PREFIX + id.getPasswordType().name(), String.class ); }
public IndyClientHttp( final PasswordManager passwordManager, final IndyObjectMapper mapper, SiteConfig location, String apiVersion ) throws IndyClientException { this.objectMapper = mapper; this.location = location; baseUrl = location.getUri(); checkBaseUrl( baseUrl ); addApiVersionHeader( apiVersion ); factory = new HttpFactory( passwordManager ); }
public IndyClientHttp( final IndyClientAuthenticator authenticator, final IndyObjectMapper mapper, SiteConfig location, String apiVersion ) throws IndyClientException { this.objectMapper = mapper; this.location = location; baseUrl = location.getUri(); checkBaseUrl( baseUrl ); addApiVersionHeader( apiVersion ); factory = new HttpFactory( authenticator ); }