Example usage for org.apache.http.params BasicHttpParams BasicHttpParams

List of usage examples for org.apache.http.params BasicHttpParams BasicHttpParams

Introduction

In this page you can find the example usage for org.apache.http.params BasicHttpParams BasicHttpParams.

Prototype

public BasicHttpParams() 

Source Link

Usage

From source file:org.ednovo.goorusearchwidget.WebService.java

public WebService(String serviceName) {
    HttpParams myParams = new BasicHttpParams();
    HttpConnectionParams.setConnectionTimeout(myParams, 10000);
    HttpConnectionParams.setSoTimeout(myParams, 10000);
    httpClient = new DefaultHttpClient(myParams);
    localContext = new BasicHttpContext();
    webServiceUrl = serviceName;/*from  w ww  .  j  av a 2 s.  co m*/
}

From source file:de.topicmapslab.couchtm.internal.utils.SysDB.java

public SysDB(String url, int port, String dbName, ITopicMapSystem sys) throws TMAPIException {
    this.url = url;
    this.port = port;
    this.dbName = dbName;
    HttpParams params = new BasicHttpParams();
    params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
    client = new DefaultHttpClient(params);
    responseHandler = new BasicResponseHandler();
    if (!dbUp())//  w w w.ja  v  a2 s .c  o  m
        throw new TMAPIException("Database not reachable");
    topicMaps = null;
    if (sys == null)
        updateTopicMapDB();
}

From source file:com.sumologic.logback.SumoLogicAppender.java

@Override
public void start() {
    super.start();
    HttpParams params = new BasicHttpParams();
    HttpConnectionParams.setConnectionTimeout(params, connectionTimeout);
    HttpConnectionParams.setSoTimeout(params, socketTimeout);
    httpClient = new DefaultHttpClient(new ThreadSafeClientConnManager(), params);
}

From source file:net.instantcom.keikosniffer.http.SessionInputBufferMockup.java

public SessionInputBufferMockup(final byte[] bytes, int buffersize) {
    this(new ByteArrayInputStream(bytes), buffersize, new BasicHttpParams());
}

From source file:org.siddhiesb.transport.http.conn.ClientConnFactory.java

public ClientConnFactory(final HttpResponseFactory responseFactory, final ByteBufferAllocator allocator,
        final SSLContextDetails ssl, final Map<String, SSLContext> sslByHostMap, final HttpParams params) {
    super();//from   w  ww.ja v a2s . c o m
    this.responseFactory = responseFactory != null ? responseFactory : new DefaultHttpResponseFactory();
    this.allocator = allocator != null ? allocator : new HeapByteBufferAllocator();
    this.ssl = ssl;
    this.sslByHostMap = sslByHostMap != null ? new ConcurrentHashMap<String, SSLContext>(sslByHostMap) : null;
    this.params = params != null ? params : new BasicHttpParams();
}

From source file:com.nextgis.mobile.map.RemoteTMSLayer.java

public RemoteTMSLayer() {
    super();/*w  w  w  .  j  a  v a  2  s.  com*/

    HttpParams httpParameters = new BasicHttpParams();
    HttpConnectionParams.setConnectionTimeout(httpParameters, TIMEOUT_CONNECTION);
    // Set the default socket timeout (SO_TIMEOUT)
    // in milliseconds which is the timeout for waiting for data.
    HttpConnectionParams.setSoTimeout(httpParameters, TIMEOUT_SOKET);

    mHTTPClient = new DefaultHttpClient(httpParameters);
    mHTTPClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, APP_USER_AGENT);
}

From source file:outfox.dict.contest.util.HttpToolKit.java

/**
 * @param maxConnectPerHost/*from  w  w  w.  ja v  a 2 s . c o  m*/
 * @param maxConnection
 * @param connectTimeOut
 * @param socketTimeOut
 * @param cookiePolicy
 * @param isAutoRetry
 * @param redirect
 */
public HttpToolKit(int maxConnectPerHost, int maxConnection, int connectTimeOut, int socketTimeOut,
        String cookiePolicy, boolean isAutoRetry, boolean redirect) {
    Scheme https = new Scheme("https", 443, SSLSocketFactory.getSocketFactory());
    Scheme http = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
    SchemeRegistry sr = new SchemeRegistry();
    sr.register(https);
    sr.register(http);

    connectionManager = new PoolingClientConnectionManager(sr, socketTimeOut, TimeUnit.MILLISECONDS);
    connectionManager.setDefaultMaxPerRoute(maxConnectPerHost);
    connectionManager.setMaxTotal(maxConnection);
    HttpParams params = new BasicHttpParams();
    params.setLongParameter(ClientPNames.CONN_MANAGER_TIMEOUT, connectTimeOut);
    params.setParameter(ClientPNames.COOKIE_POLICY, cookiePolicy);
    params.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, redirect);
    params.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, false);

    if (isAutoRetry) {
        client = new AutoRetryHttpClient(new DefaultHttpClient(connectionManager, params));
    } else {
        client = new DefaultHttpClient(connectionManager, params);
    }
}

From source file:com.erdao.PhotSpot.JsonFeedGetter.java

public JsonFeedGetter(Context c, int mode) {
    mode_ = mode;/*  w  w  w  .j ava2s .c  o  m*/
    context_ = c;
    final HttpParams httpParams = new BasicHttpParams();
    HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1);
    HttpProtocolParams.setContentCharset(httpParams, "UTF-8");
    HttpConnectionParams.setConnectionTimeout(httpParams, connection_Timeout);
    HttpConnectionParams.setSoTimeout(httpParams, connection_Timeout);
    final SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
    httpClient_ = new DefaultHttpClient(new ThreadSafeClientConnManager(httpParams, schemeRegistry),
            httpParams);

}

From source file:org.overlord.apiman.service.client.http.HTTPServiceClient.java

/**
 * {@inheritDoc}/*from w w w .  j  av  a2s . c o  m*/
 */
public void init() {
    HttpParams hcParams = new BasicHttpParams();
    //readConfigParam(hcParams, ClientPNames.HANDLE_REDIRECTS, Boolean.class);
    _proxyClient = new DefaultHttpClient(new PoolingClientConnectionManager(), hcParams);
}

From source file:com.jcn.dlna.sdk.dms.httpserver.HttpServer.java

private HttpServer(WifiManager wifiManager) {
    this.wifiManager = wifiManager;
    this.listenPort = 0;

    this.handlerRegistry = new HttpRequestHandlerRegistry();

    this.params = new BasicHttpParams();
    this.params.setParameter(CoreProtocolPNames.ORIGIN_SERVER, "4thLineAndroidHttpServer/1.0")
            .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
            .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
            .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
            .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true);

    startServer();//from  w ww .  j a  v  a 2s .c om
}