本文整理汇总了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);
}
}
}
示例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);
}
}
示例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);
}