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


Java HttpRequest.getParams方法代码示例

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


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

示例1: process

import ch.boye.httpclientandroidlib.HttpRequest; //导入方法依赖的package包/类
public void process(final HttpRequest request, final HttpContext context)
    throws HttpException, IOException {
    Args.notNull(request, "HTTP request");
    if (!request.containsHeader(HTTP.USER_AGENT)) {
        String s = null;
        final HttpParams params = request.getParams();
        if (params != null) {
            s = (String) params.getParameter(CoreProtocolPNames.USER_AGENT);
        }
        if (s == null) {
            s = this.userAgent;
        }
        if (s != null) {
            request.addHeader(HTTP.USER_AGENT, s);
        }
    }
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:18,代码来源:RequestUserAgent.java

示例2: doExecute

import ch.boye.httpclientandroidlib.HttpRequest; //导入方法依赖的package包/类
@Override
protected CloseableHttpResponse doExecute(
        final HttpHost target,
        final HttpRequest request,
        final HttpContext context) throws IOException, ClientProtocolException {
    Args.notNull(request, "HTTP request");
    HttpExecutionAware execAware = null;
    if (request instanceof HttpExecutionAware) {
        execAware = (HttpExecutionAware) request;
    }
    try {
        final HttpRequestWrapper wrapper = HttpRequestWrapper.wrap(request);
        final HttpClientContext localcontext = HttpClientContext.adapt(
                context != null ? context : new BasicHttpContext());
        RequestConfig config = null;
        if (request instanceof Configurable) {
            config = ((Configurable) request).getConfig();
        }
        if (config == null) {
            final HttpParams params = request.getParams();
            if (params instanceof HttpParamsNames) {
                if (!((HttpParamsNames) params).getNames().isEmpty()) {
                    config = HttpClientParamConfig.getRequestConfig(params);
                }
            } else {
                config = HttpClientParamConfig.getRequestConfig(params);
            }
        }
        if (config != null) {
            localcontext.setRequestConfig(config);
        }
        setupContext(localcontext);
        final HttpRoute route = determineRoute(target, wrapper, localcontext);
        return this.execChain.execute(route, wrapper, localcontext, execAware);
    } catch (final HttpException httpException) {
        throw new ClientProtocolException(httpException);
    }
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:39,代码来源:InternalHttpClient.java

示例3: determineParams

import ch.boye.httpclientandroidlib.HttpRequest; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:20,代码来源:AbstractHttpClient.java


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