protected HttpClient getHttpClient() { if (this.httpClient == null) { HttpClientConfiguratorLoader configuratorLoader = new HttpClientConfiguratorLoader(this.state); this.httpClient = configuratorLoader.getConfigurator() .setStatePropertiesPrefix(ConfigurationKeys.SOURCE_CONN_PREFIX) .configure(this.state) .createClient(); } return this.httpClient; }
/** Loads a HttpClientConfigurator with the specified class or alias. If not specified, * {@link #DEFAULT_CONFIGURATOR_CLASS} is used. */ public HttpClientConfiguratorLoader(Optional<String> configuratorType) { try { _configurator = getConfiguratorClass(configuratorType).newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { throw new RuntimeException("Unable to find HttpClientConfigurator:" + e, e); } }
@Override public void run() throws Throwable { new HttpClientConfiguratorLoader(config); } });
public HttpClientBuilder getDefaultHttpClientBuilder() { HttpClientConfiguratorLoader clientConfiguratorLoader = new HttpClientConfiguratorLoader(getState()); clientConfiguratorLoader.getConfigurator().setStatePropertiesPrefix(AbstractHttpWriterBuilder.CONF_PREFIX); return clientConfiguratorLoader.getConfigurator().configure(getState()) .getBuilder().disableCookieManagement().useSystemProperties(); }
/** Loads a HttpClientConfigurator with the specified class or alias. If not specified, * {@link #DEFAULT_CONFIGURATOR_CLASS} is used. */ public HttpClientConfiguratorLoader(Optional<String> configuratorType) { try { _configurator = getConfiguratorClass(configuratorType).newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { throw new RuntimeException("Unable to find HttpClientConfigurator:" + e, e); } }
@Test public void testConfigureFromState() { HttpClientConfiguratorLoader loader = new HttpClientConfiguratorLoader(new State()); Assert.assertEquals(loader.getConfigurator().getClass(), DefaultHttpClientConfigurator.class); State state = new State(); state.setProp(HttpClientConfiguratorLoader.HTTP_CLIENT_CONFIGURATOR_TYPE_FULL_KEY, "default"); loader = new HttpClientConfiguratorLoader(state); Assert.assertEquals(loader.getConfigurator().getClass(), DefaultHttpClientConfigurator.class); }
= new HttpClientConfiguratorLoader(workUnitState); this.httpClientConfigurator = httpClientConfiguratorLoader.getConfigurator(); this.httpClientConfigurator.setStatePropertiesPrefix(HTTP_CLIENT_CONFIG_PREFIX) .configure(workUnitState);
protected HttpClient getHttpClient() { if (this.httpClient == null) { HttpClientConfiguratorLoader configuratorLoader = new HttpClientConfiguratorLoader(this.state); this.httpClient = configuratorLoader.getConfigurator() .setStatePropertiesPrefix(ConfigurationKeys.SOURCE_CONN_PREFIX) .configure(this.state) .createClient(); } return this.httpClient; }
public HttpClientBuilder getDefaultHttpClientBuilder() { HttpClientConfiguratorLoader clientConfiguratorLoader = new HttpClientConfiguratorLoader(getState()); clientConfiguratorLoader.getConfigurator().setStatePropertiesPrefix(AbstractHttpWriterBuilder.CONF_PREFIX); return clientConfiguratorLoader.getConfigurator().configure(getState()) .getBuilder().disableCookieManagement().useSystemProperties(); }
= new HttpClientConfiguratorLoader(workUnitState); this.httpClientConfigurator = httpClientConfiguratorLoader.getConfigurator(); this.httpClientConfigurator.setStatePropertiesPrefix(HTTP_CLIENT_CONFIG_PREFIX) .configure(workUnitState);