private void completeAuth(Object[] authSettings) { if (authSettings[1] != null) { client.setState((HttpState) authSettings[1]); client.getParams().setAuthenticationPreemptive(true); } }
if (state == null) { state = new HttpState(); client.setState(state);
if (state == null) { state = new HttpState(); client.setState(state);
@Override public synchronized void setState(HttpState state) { delegate.setState(state); }
private void completeAuth(Object[] authSettings) { if (authSettings[1] != null) { client.setState((HttpState) authSettings[1]); client.getParams().setAuthenticationPreemptive(true); } }
private void completeAuth(Object[] authSettings) { if (authSettings[1] != null) { client.setState((HttpState) authSettings[1]); client.getParams().setAuthenticationPreemptive(true); } }
private void completeAuth(Object[] authSettings) { if (authSettings[1] != null) { client.setState((HttpState) authSettings[1]); client.getParams().setAuthenticationPreemptive(true); } }
private void completeAuth(Object[] authSettings) { if (authSettings[1] != null) { client.setState((HttpState) authSettings[1]); client.getParams().setAuthenticationPreemptive(true); } }
private void setState(HttpState state) { getClient().setState(state); }
/** * Initializes this {@link HTTPClientSource} instance. * * @exception Exception if an error occurs */ public void initialize() throws Exception { this.m_client = new HttpClient(); if ( this.m_proxyHost != null && this.m_proxyPort != -1 ) { this.m_client.getHostConfiguration().setProxy( this.m_proxyHost, this.m_proxyPort ); } if (this.m_httpState != null) { this.m_client.setState(this.m_httpState); } this.m_dataValid = false; }
/** * Discover and refresh lock tokens for a specific owner. * * @param owner the owner who's locks are to be discovered. * @exception HttpException * @exception IOException */ public void discoverOwnLocks(String owner) throws HttpException, IOException { setClient(); WebdavState state = (WebdavState) client.getState(); state = discoverLock(owner, httpURL.getPath(), state); client.setState(state); }
RestSession(RestClientConfiguration configuration) { showRequest = configuration.isVerbose(); this.configuration = configuration; client = new HttpClient(); HostConfiguration hostConfiguration = new HostConfiguration(); // Anomalie #917: Can not specify port in rest api (tchemit 2010-10-07) int port = configuration.getRestUrl().getPort(); if (port == -1) { // no port set hostConfiguration.setHost(configuration.getRestUrl().getHost()); } else { // a specific port is asked hostConfiguration.setHost(configuration.getRestUrl().getHost(), port); } // set encoding (will then encode parameters fine) client.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, configuration.getEncoding()); client.setHostConfiguration(hostConfiguration); client.setState(new HttpState()); }
public void init() { client = new HttpClient(new MultiThreadedHttpConnectionManager()); client.getHttpConnectionManager().getParams().setConnectionTimeout(timeout); client.getParams().setCookiePolicy(CookiePolicy.RFC_2109); client.setState(httpState); if (authPrefs != null) { client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs); } if (proxyHost != null) { client.getHostConfiguration().setProxy(proxyHost, proxyPort); if (proxyUserPassword != null) { httpState.setProxyCredentials(new AuthScope(proxyHost, proxyPort), proxyUserPassword); } } }
public void init() { client = new HttpClient(new MultiThreadedHttpConnectionManager()); client.getHttpConnectionManager().getParams() .setConnectionTimeout(timeout); client.getParams().setCookiePolicy(CookiePolicy.RFC_2109); client.setState(httpState); if (authPrefs != null) { client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs); } if (proxyHost != null) { client.getHostConfiguration().setProxy(proxyHost, proxyPort); if (proxyUserPassword != null) { httpState.setProxyCredentials(new AuthScope(proxyHost, proxyPort), proxyUserPassword); } } }
public MockBrowser(HttpClient httpClient) { _httpClient = httpClient; HttpConnectionManager connectionManager = httpClient.getHttpConnectionManager(); if (connectionManager instanceof MultiThreadedHttpConnectionManager) { _threadPool = Executors.newFixedThreadPool(10); } else { LOG.warn("The configured HttpClient does not use a MultiThreadedHttpConnectionManager, will only use 1 thread (instead of 10) for downloading CSS files and checking image URLs ..."); _threadPool = Executors.newFixedThreadPool(1); } HttpState httpState = new HttpState(); WebDriver driver = _webPage.getDriver(); for (org.openqa.selenium.Cookie cookie : driver.manage().getCookies()) { httpState.addCookie(new Cookie(cookie.getDomain(), cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getExpiry(), cookie.isSecure())); } _httpClient.setState(httpState); }
/** * Discover and refresh lock tokens. * * @exception HttpException * @exception IOException */ public void discoverOwnLocks() throws HttpException, IOException { setClient(); String owner = (httpURL.getUser() != null) ? httpURL.getUser() : defaultOwner; WebdavState state = (WebdavState) client.getState(); state = discoverLock(owner, httpURL.getPath(), state); client.setState(state); }
/** * This method is useful in Client environment where Firewall is set to prevent accessing the external services. * Proxy settings are required in such scenarios. * @param httpClient */ private void setProxy(HttpClient httpClient) { if (mc.getProxyHost() != null) { httpClient.getHostConfiguration().setProxy( mc.getProxyHost(), mc.getProxyPort()); if (mc.getProxyUser() != null) { List<String> authPrefs = new ArrayList<String>(); authPrefs.add(AuthPolicy.BASIC); httpClient.getParams().setParameter( AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs); HttpState state = new HttpState(); state.setProxyCredentials( AuthScope.ANY, new UsernamePasswordCredentials( mc.getProxyUser(), mc.getProxyPassword())); httpClient.setState(state); } } }
protected HttpClient doClientConnect() throws Exception { HttpState state = new HttpState(); if (getProxyUsername() != null) { Credentials credentials; if (isProxyNtlmAuthentication()) { credentials = new NTCredentials(getProxyUsername(), getProxyPassword(), getProxyHostname(), ""); } else { credentials = new UsernamePasswordCredentials(getProxyUsername(), getProxyPassword()); } AuthScope authscope = new AuthScope(getProxyHostname(), getProxyPort()); state.setProxyCredentials(authscope, credentials); } HttpClient client = new HttpClient(); client.setState(state); client.setHttpConnectionManager(getClientConnectionManager()); return client; }