/** * Sets whether authentication should be attempted preemptively. * * @param value <tt>true</tt> if authentication should be attempted preemptively, * <tt>false</tt> otherwise. */ public void setAuthenticationPreemptive(boolean value) { setBooleanParameter(PREEMPTIVE_AUTHENTICATION, value); }
/** * Sets whether authentication should be attempted preemptively. * * @param value <tt>true</tt> if authentication should be attempted preemptively, * <tt>false</tt> otherwise. */ public void setAuthenticationPreemptive(boolean value) { setBooleanParameter(PREEMPTIVE_AUTHENTICATION, value); }
/** * Sets whether authentication should be attempted preemptively. * * @param value <tt>true</tt> if authentication should be attempted preemptively, * <tt>false</tt> otherwise. */ public void setAuthenticationPreemptive(boolean value) { setBooleanParameter(PREEMPTIVE_AUTHENTICATION, value); }
/** * Sets whether authentication should be attempted preemptively. * * @param value <tt>true</tt> if authentication should be attempted preemptively, * <tt>false</tt> otherwise. */ public void setAuthenticationPreemptive(boolean value) { setBooleanParameter(PREEMPTIVE_AUTHENTICATION, value); }
/** * Sets whether authentication should be attempted preemptively. * * @param value <tt>true</tt> if authentication should be attempted preemptively, * <tt>false</tt> otherwise. */ public void setAuthenticationPreemptive(boolean value) { setBooleanParameter(PREEMPTIVE_AUTHENTICATION, value); }
/** * Sets whether or not circular redirects are allowed. * <p> * Circular redirects happen when a request redirects to itself, or when a same request was already accessed in a chain of * redirects. * <p> * Since 2.5.0, the default is to allow circular redirects. * * @param allow {@code true} if circular redirects should be allowed, {@code false} otherwise * @since 2.4.0 */ public void setAllowCircularRedirects(boolean allow) { client.getParams().setBooleanParameter(HttpClientParams.ALLOW_CIRCULAR_REDIRECTS, allow); clientViaProxy.getParams().setBooleanParameter(HttpClientParams.ALLOW_CIRCULAR_REDIRECTS, allow); }
/** * Sets whether or not the authentication headers ("Authorization" and "Proxy-Authorization") already present in the request * should be removed if received an authentication challenge (status codes 401 and 407). * <p> * If {@code true} new authentication headers will be generated and the old ones removed otherwise the authentication * headers already present in the request will be used to authenticate. * <p> * Default is {@code false}, i.e. use the headers already present in the request header. * <p> * Processes that reuse messages previously sent should consider setting this to {@code true}, otherwise new authentication * challenges might fail. * * @param removeHeaders {@code true} if the the authentication headers already present should be removed when challenged, * {@code false} otherwise */ public void setRemoveUserDefinedAuthHeaders(boolean removeHeaders) { client.getParams().setBooleanParameter(HttpMethodDirector.PARAM_REMOVE_USER_DEFINED_AUTH_HEADERS, removeHeaders); clientViaProxy.getParams().setBooleanParameter(HttpMethodDirector.PARAM_REMOVE_USER_DEFINED_AUTH_HEADERS, removeHeaders); }
public void init() { ParameterCheck.mandatory("baseUrl", baseUrl); StringBuilder sb = new StringBuilder(); sb.append(baseUrl + "/admin/cores"); this.adminUrl = sb.toString(); httpClient = httpClientFactory.getHttpClient(); HttpClientParams params = httpClient.getParams(); params.setBooleanParameter(HttpClientParams.PREEMPTIVE_AUTHENTICATION, true); httpClient.getState().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials("admin", "admin")); }
public void init() { ParameterCheck.mandatory("baseUrl", baseUrl); StringBuilder sb = new StringBuilder(); sb.append(baseUrl + "/admin/cores"); this.adminUrl = sb.toString(); httpClient = httpClientFactory.getHttpClient(); HttpClientParams params = httpClient.getParams(); params.setBooleanParameter(HttpClientParams.PREEMPTIVE_AUTHENTICATION, true); httpClient.getState().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials("admin", "admin")); }
HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager); httpClient.getParams().setBooleanParameter(HttpClientParams.USE_EXPECT_CONTINUE, false); httpClient.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
/** * Create an AbderaClient instance using the specified Abdera instance and useragent name * * @param abdera * @param useragent */ public AbderaClient(Abdera abdera, String useragent, Cache cache) { this.abdera = abdera; this.cache = cache; MultiThreadedHttpConnectionManager connManager = new MultiThreadedHttpConnectionManager(); client = new HttpClient(connManager); client.getParams().setParameter(HttpClientParams.USER_AGENT, useragent); client.getParams().setBooleanParameter(HttpClientParams.USE_EXPECT_CONTINUE, true); client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); setAuthenticationSchemeDefaults(); setMaximumRedirects(DEFAULT_MAX_REDIRECTS); }
protected HttpClient constructHttpClient() { MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager(); HttpClient httpClient = new HttpClient(connectionManager); HttpClientParams params = httpClient.getParams(); params.setBooleanParameter(HttpConnectionParams.TCP_NODELAY, true); params.setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK, true); params.setSoTimeout(socketTimeout); HttpConnectionManagerParams connectionManagerParams = httpClient.getHttpConnectionManager().getParams(); connectionManagerParams.setMaxTotalConnections(maxTotalConnections); connectionManagerParams.setDefaultMaxConnectionsPerHost(maxHostConnections); connectionManagerParams.setConnectionTimeout(connectionTimeout); return httpClient; }
protected HttpClient constructHttpClient() { MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager(); HttpClient httpClient = new HttpClient(connectionManager); HttpClientParams params = httpClient.getParams(); params.setBooleanParameter(HttpConnectionParams.TCP_NODELAY, true); params.setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK, true); if (socketTimeout != null) { params.setSoTimeout(socketTimeout); } HttpConnectionManagerParams connectionManagerParams = httpClient.getHttpConnectionManager().getParams(); connectionManagerParams.setMaxTotalConnections(maxTotalConnections); connectionManagerParams.setDefaultMaxConnectionsPerHost(maxHostConnections); connectionManagerParams.setConnectionTimeout(connectionTimeout); return httpClient; }
client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, singleCookieRequestHeader); clientViaProxy.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, singleCookieRequestHeader); String defaultUserAgent = param.getDefaultUserAgent();
client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true); wrapper = new HttpClientWrapper(client, connectionManager, initialState); return wrapper;
@Override protected void setUp() throws Exception { super.setUp(); if (remoteServer != null) { httpClient = new HttpClient(); httpClient.getParams().setBooleanParameter(HttpClientParams.PREEMPTIVE_AUTHENTICATION, true); if (remoteServer.username != null) { httpClient.getState().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials(remoteServer.username, remoteServer.password)); } } }
this.cl.getHttpConnectionManager().getParams().setSoTimeout( this.http.getTimeout() ); this.cl.getParams().setBooleanParameter( HttpClientParams.ALLOW_CIRCULAR_REDIRECTS, true );
client.getParams().setParameter("http.useragent", USER_AGENT); boolean disableEC = Boolean.valueOf((String)context.getContextualProperty(DISABLE_EXPECT_CONTINUE)).booleanValue(); client.getParams().setBooleanParameter("http.protocol.expect-continue", !disableEC); client.getParams().setVersion(HttpVersion.HTTP_1_1); String timeoutStr = (String) context.getContextualProperty(HTTP_TIMEOUT);