当前位置: 首页>>代码示例>>Java>>正文


Java DefaultHttpClient.getParams方法代码示例

本文整理汇总了Java中org.apache.http.impl.client.DefaultHttpClient.getParams方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultHttpClient.getParams方法的具体用法?Java DefaultHttpClient.getParams怎么用?Java DefaultHttpClient.getParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.http.impl.client.DefaultHttpClient的用法示例。


在下文中一共展示了DefaultHttpClient.getParams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getParams

import org.apache.http.impl.client.DefaultHttpClient; //导入方法依赖的package包/类
public HttpParams getParams() {
    try {
        DefaultHttpClient defaultHttpClient = this.bнн043Dн043Dн;
        if (((b04170417041704170417З + b0417ЗЗЗЗ0417) * b04170417041704170417З) % bЗ0417ЗЗЗ0417 != bЗЗЗЗЗ0417) {
            b04170417041704170417З = b04170417ЗЗЗ0417();
            bЗЗЗЗЗ0417 = 88;
        }
        try {
            return defaultHttpClient.getParams();
        } catch (Exception e) {
            throw e;
        }
    } catch (Exception e2) {
        throw e2;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:17,代码来源:ImmersionHttpClient.java

示例2: createHttpClient

import org.apache.http.impl.client.DefaultHttpClient; //导入方法依赖的package包/类
/**
 * Constructs a new DefaultHttpClient with a default 30 second timeout.
 */
public static DefaultHttpClient createHttpClient() {
    DefaultHttpClient client = new DefaultHttpClient();
    final HttpParams params = client.getParams();
    HttpConnectionParams.setConnectionTimeout(params,
        REGISTRATION_TIMEOUT);
    HttpConnectionParams.setSoTimeout(params, REGISTRATION_TIMEOUT);
    ConnManagerParams.setTimeout(params, REGISTRATION_TIMEOUT);
    return client;
}
 
开发者ID:Greenstand,项目名称:treetracker-android,代码行数:13,代码来源:NetworkUtilities.java

示例3: doRefer

import org.apache.http.impl.client.DefaultHttpClient; //导入方法依赖的package包/类
protected <T> T doRefer(Class<T> serviceType, URL url) throws RpcException {
        if (connectionMonitor == null) {
            connectionMonitor = new ConnectionMonitor();
        }

        // TODO more configs to add

        PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager();
        // 20 is the default maxTotal of current PoolingClientConnectionManager
        connectionManager.setMaxTotal(url.getParameter(Constants.CONNECTIONS_KEY, 20));
        connectionManager.setDefaultMaxPerRoute(url.getParameter(Constants.CONNECTIONS_KEY, 20));

        connectionMonitor.addConnectionManager(connectionManager);

//        BasicHttpContext localContext = new BasicHttpContext();

        DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager);

        httpClient.setKeepAliveStrategy(new ConnectionKeepAliveStrategy() {
            public long getKeepAliveDuration(HttpResponse response, HttpContext context) {
                HeaderElementIterator it = new BasicHeaderElementIterator(response.headerIterator(HTTP.CONN_KEEP_ALIVE));
                while (it.hasNext()) {
                    HeaderElement he = it.nextElement();
                    String param = he.getName();
                    String value = he.getValue();
                    if (value != null && param.equalsIgnoreCase("timeout")) {
                        return Long.parseLong(value) * 1000;
                    }
                }
                // TODO constant
                return 30 * 1000;
            }
        });

        HttpParams params = httpClient.getParams();
        // TODO currently no xml config for Constants.CONNECT_TIMEOUT_KEY so we directly reuse Constants.TIMEOUT_KEY for now
        HttpConnectionParams.setConnectionTimeout(params, url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT));
        HttpConnectionParams.setSoTimeout(params, url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT));
        HttpConnectionParams.setTcpNoDelay(params, true);
        HttpConnectionParams.setSoKeepalive(params, true);

        ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient/*, localContext*/);

        ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build();
        clients.add(client);

        client.register(RpcContextFilter.class);
        for (String clazz : Constants.COMMA_SPLIT_PATTERN.split(url.getParameter(Constants.EXTENSION_KEY, ""))) {
            if (!StringUtils.isEmpty(clazz)) {
                try {
                    client.register(Thread.currentThread().getContextClassLoader().loadClass(clazz.trim()));
                } catch (ClassNotFoundException e) {
                    throw new RpcException("Error loading JAX-RS extension class: " + clazz.trim(), e);
                }
            }
        }

        // TODO protocol
        ResteasyWebTarget target = client.target("http://" + url.getHost() + ":" + url.getPort() + "/" + getContextPath(url));
        return target.proxy(serviceType);
    }
 
开发者ID:zhuxiaolei,项目名称:dubbo2,代码行数:62,代码来源:RestProtocol.java


注:本文中的org.apache.http.impl.client.DefaultHttpClient.getParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。