public KojiClient( KojiConfig config, PasswordManager passwordManager, ExecutorService executorService, MetricRegistry metricRegistry ) throws KojiClientException { this.config = config; this.httpFactory = new HttpFactory( passwordManager ); this.executorService = executorService; this.metricRegistry = metricRegistry; setup(); }
public CloseableHttpClient createClient() throws JHttpCException { return createClient( null, null ); }
public HttpClientContext createContext() throws JHttpCException { return createContext( null ); }
SiteConnectionConfig connConfig = new SiteConnectionConfig( location ); final SSLConnectionSocketFactory sslFac = createSSLSocketFactory( location ); if ( sslFac != null ) new HttpHost( location.getProxyHost(), getProxyPort( location ) ) ); builder.setRoutePlanner( planner );
copyContextPrototype( prototype, ctx ); new AuthScope( location.getProxyHost(), getProxyPort( location ) ), location, PasswordType.PROXY, ctx );
@Override public void close() { logger.debug( "Shutting down indy client HTTP manager" ); try { factory.close(); } catch ( IOException e ) { logger.debug( "Shutting down indy client HTTP factory error", e ); // log and return quietly } }
public CloseableHttpClient newClient() throws IndyClientException { try { return factory.createClient( location, defaultHeaders ); } catch ( JHttpCException e ) { throw new IndyClientException( "Indy request failed: %s", e, e.getMessage() ); } }
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 ); }
public HttpClientContext newContext() throws IndyClientException { try { return factory.createContext( location ); } catch ( JHttpCException e ) { throw new IndyClientException( "Indy request failed: %s", e, e.getMessage() ); } }
/** * Create http client and apply site config. * @param siteId ID to represent the site. It is generally the hostname of target site. * @return * @throws IndyHttpException */ public CloseableHttpClient createClient( final String siteId ) throws IndyHttpException { try { return httpFactory.createClient( siteConfigLookup.lookup( siteId ) ); } catch ( JHttpCException e ) { throw new IndyHttpException( "Failed to create http client: %s", e, e.getMessage() ); } }
public HttpImpl( final PasswordManager passwords ) { this.passwords = passwords; this.locationLookup = new LocationLookup(); this.httpFactory = new HttpFactory( new HttpFactoryPasswordDelegate( passwords, locationLookup ) ); }
/** * Create http request context and apply site config. * @param siteId ID to represent the site. It is generally the hostname of target site. * @return * @throws IndyHttpException */ public HttpClientContext createContext( final String siteId ) throws IndyHttpException { try { return httpFactory.createContext( siteConfigLookup.lookup( siteId ) ); } catch ( JHttpCException e ) { throw new IndyHttpException( "Failed to create http client context: %s", e, e.getMessage() ); } }
try client = httpFactory.createClient( config.getKojiSiteConfig() );
@PostConstruct public void setup() { passwordManager = new org.commonjava.maven.galley.auth.AttributePasswordManager(); http = new HttpImpl( passwordManager ); httpFactory = new HttpFactory( new AttributePasswordManager( siteConfigLookup ) ); }
try client = httpFactory.createClient( siteConfig );
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 ); }
return httpFactory.createClient( config ); return httpFactory.createClient();
@PostConstruct private void postConstruct() { try { PasswordManager emptyPasswordManager = new MemoryPasswordManager(); SiteConfig sc = new SiteConfigBuilder().withId("Carto") .withUri(config.getConfig().getCartographerServerUrl()) .withRequestTimeoutSeconds(config.getConfig().getAproxRequestTimeout()).build(); HttpFactory httpFactory = new HttpFactory(emptyPasswordManager); cartographer = new CartographerRESTClient(sc, httpFactory); } catch (ConfigurationParseException | ClientHttpException e) { throw new IllegalStateException("Could not initialize Cartographer Client.", e); } }