/** * Adjust the socket timeout, i.e. the amount of time that may pass when waiting for data coming * in from the server. Time unit is milliseconds. * * @param socketTimeout * the timeout in milliseconds * @see CoreConnectionPNames#SO_TIMEOUT */ public void setSocketTimeout(int socketTimeout) { HttpConnectionParams.setSoTimeout(httpClient.getParams(), socketTimeout); }
/** * Set the default HTTP proxy to be used for all requests. * * @param host host name or IP * @param port port, or -1 for the default port * @param scheme usually "http" or "https," or <code>null</code> for the default * @see HttpHost#HttpHost(String, int, String) */ public void setProxy(String host, int port, String scheme) { getClient().getParams().setParameter( ConnRoutePNames.DEFAULT_PROXY, new HttpHost(host, port, scheme)); }
/** * Adjust the connection timeout, i.e. the amount of time that may pass in order to establish a * connection with the server. Time unit is milliseconds. * * @param connectionTimeout * the timeout in milliseconds * @see CoreConnectionPNames#CONNECTION_TIMEOUT */ public void setConnectionTimeout(int connectionTimeout) { ConnManagerParams.setTimeout(httpClient.getParams(), connectionTimeout); }
public void setMaximumConnections(int maxConnections) { ConnManagerParams.setMaxTotalConnections(httpClient.getParams(), maxConnections); }
@Override public IgnitedHttpRequest withTimeout(int timeout) { oldSocketTimeout = httpClient.getParams().getIntParameter(CoreConnectionPNames.SO_TIMEOUT, IgnitedHttp.DEFAULT_SOCKET_TIMEOUT); oldConnTimeout = httpClient.getParams().getIntParameter( CoreConnectionPNames.CONNECTION_TIMEOUT, IgnitedHttp.DEFAULT_WAIT_FOR_CONNECTION_TIMEOUT); ignitedHttp.setSocketTimeout(timeout); ignitedHttp.setConnectionTimeout(timeout); timeoutChanged = true; return this; }
/** * Obtains parameters for executing a request. * The default implementation in this class creates a new * {@link ClientParamsStack} from the request parameters * and the client parameters. * <br/> * This method is called by the default implementation of * {@link #execute(HttpHost,HttpRequest,HttpContext)} * to obtain the parameters for the * {@link DefaultRequestDirector}. * * @param req the request that will be executed * * @return the parameters to use */ protected HttpParams determineParams(HttpRequest req) { return new ClientParamsStack (null, getParams(), req.getParams(), null); }
return; HttpParams httpParams = httpClient.getParams(); ConnectivityManager connectivity = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE);
/** * Set the default HTTP proxy to be used for all requests. * @see HttpHost#HttpHost(String, int, String) * @param host host name or IP * @param port port, or -1 for the default port * @param scheme usually "http" or "https," or <code>null</code> for the default */ public void setProxy( String host, int port, String scheme ) { getClient().getParams().setParameter( ConnRoutePNames.DEFAULT_PROXY, new HttpHost(host,port,scheme) ); }
/** * * @return the User-Agent that HttpClient is currently using. */ public String getUserAgent() { return HttpProtocolParams.getUserAgent(this.client.getParams()); }
@Override protected AbstractHttpClient createHttpClient() { AbstractHttpClient client = super.createHttpClient(); // Set it to do some retrying in case of closed connection during test. client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(5, false)); return client; }
/** * * @param userAgent The value to set User-Agent HTTP parameter to for requests * @return */ public MechanizeAgent setUserAgent(final String userAgent) { HttpProtocolParams.setUserAgent(this.client.getParams(), userAgent); return this; }
public void setUserAgent(String userAgent) { HttpProtocolParams.setUserAgent(httpClient.getParams(), userAgent); }
/** * Obtains parameters for executing a request. * The default implementation in this class creates a new * {@link ClientParamsStack} from the request parameters * and the client parameters. * <br/> * This method is called by the default implementation of * {@link #execute(HttpHost,HttpRequest,HttpContext)} * to obtain the parameters for the * {@link DefaultRequestDirector}. * * @param req the request that will be executed * * @return the parameters to use */ protected HttpParams determineParams(HttpRequest req) { return new ClientParamsStack (null, getParams(), req.getParams(), null); }
/** * Obtains parameters for executing a request. * The default implementation in this class creates a new * {@link ClientParamsStack} from the request parameters * and the client parameters. * <br/> * This method is called by the default implementation of * {@link #execute(HttpHost,HttpRequest,HttpContext)} * to obtain the parameters for the * {@link DefaultRequestDirector}. * * @param req the request that will be executed * * @return the parameters to use */ protected HttpParams determineParams(final HttpRequest req) { return new ClientParamsStack (null, getParams(), req.getParams(), null); }
/** * Obtains parameters for executing a request. * The default implementation in this class creates a new * {@link ClientParamsStack} from the request parameters * and the client parameters. * <br/> * This method is called by the default implementation of * {@link #execute(HttpHost,HttpRequest,HttpContext)} * to obtain the parameters for the * {@link DefaultRequestDirector}. * * @param req the request that will be executed * * @return the parameters to use */ protected HttpParams determineParams(HttpRequest req) { return new ClientParamsStack (null, getParams(), req.getParams(), null); }
/** * Obtains parameters for executing a request. * The default implementation in this class creates a new * {@link ClientParamsStack} from the request parameters * and the client parameters. * <br/> * This method is called by the default implementation of * {@link #execute(HttpHost,HttpRequest,HttpContext)} * to obtain the parameters for the * {@link DefaultRequestDirector}. * * @param req the request that will be executed * * @return the parameters to use */ protected HttpParams determineParams(HttpRequest req) { return new ClientParamsStack (null, getParams(), req.getParams(), null); }
/** * Obtains parameters for executing a request. * The default implementation in this class creates a new * {@link ClientParamsStack} from the request parameters * and the client parameters. * <p> * This method is called by the default implementation of * {@link #execute(HttpHost,HttpRequest,HttpContext)} * to obtain the parameters for the * {@link DefaultRequestDirector}. * </p> * * @param req the request that will be executed * * @return the parameters to use */ protected HttpParams determineParams(final HttpRequest req) { return new ClientParamsStack (null, getParams(), req.getParams(), null); }
/** * Obtains parameters for executing a request. * The default implementation in this class creates a new * {@link ClientParamsStack} from the request parameters * and the client parameters. * <p> * This method is called by the default implementation of * {@link #execute(HttpHost,HttpRequest,HttpContext)} * to obtain the parameters for the * {@link DefaultRequestDirector}. * </p> * * @param req the request that will be executed * * @return the parameters to use */ protected HttpParams determineParams(final HttpRequest req) { return new ClientParamsStack (null, getParams(), req.getParams(), null); }
HTTPRepository repo = ....; AbstractHttpClient httpClient = (AbstractHttpClient)((SesameClientImpl)repo.getSesameClient()).getHtttpClient(); HttpParams params = httpClient.getParams(); params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 2000); httpClient.setParams(params);
public HttpClientProvider() { httpClient = SystemUtils.createHttpClient(); HttpConnectionParams.setConnectionTimeout(httpClient.getParams(), DEFAULT_CONNECT_TIMEOUT); HttpConnectionParams.setSoTimeout(httpClient.getParams(), DEFAULT_SOCKET_TIMEOUT); ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(httpClient.getConnectionManager().getSchemeRegistry(), ProxySelector.getDefault()); httpClient.setRoutePlanner(routePlanner); httpClient.setKeepAliveStrategy(new ConnectionKeepAliveStrategy(DEFAULT_CONNECTION_KEEP_ALIVE_DURATION)); cachingHttpClient = new EtagCachingHttpClient(httpClient, createStorage()); }