本文整理汇总了Java中org.apache.http.params.HttpParams.getParameter方法的典型用法代码示例。如果您正苦于以下问题:Java HttpParams.getParameter方法的具体用法?Java HttpParams.getParameter怎么用?Java HttpParams.getParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.http.params.HttpParams
的用法示例。
在下文中一共展示了HttpParams.getParameter方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newInstance
import org.apache.http.params.HttpParams; //导入方法依赖的package包/类
public CookieSpec newInstance(final HttpParams params) {
if (params != null) {
String[] patterns = null;
Collection<?> param = (Collection<?>) params.getParameter(
CookieSpecPNames.DATE_PATTERNS);
if (param != null) {
patterns = new String[param.size()];
patterns = param.toArray(patterns);
}
boolean singleHeader = params.getBooleanParameter(
CookieSpecPNames.SINGLE_COOKIE_HEADER, false);
return new BestMatchSpec(patterns, singleHeader);
} else {
return new BestMatchSpec();
}
}
示例2: newInstance
import org.apache.http.params.HttpParams; //导入方法依赖的package包/类
public CookieSpec newInstance(final HttpParams params) {
if (params != null) {
String[] patterns = null;
Collection<?> param = (Collection<?>) params.getParameter(
CookieSpecPNames.DATE_PATTERNS);
if (param != null) {
patterns = new String[param.size()];
patterns = param.toArray(patterns);
}
boolean singleHeader = params.getBooleanParameter(
CookieSpecPNames.SINGLE_COOKIE_HEADER, false);
return new RFC2109Spec(patterns, singleHeader);
} else {
return new RFC2109Spec();
}
}
示例3: newInstance
import org.apache.http.params.HttpParams; //导入方法依赖的package包/类
public CookieSpec newInstance(final HttpParams params) {
if (params != null) {
String[] patterns = null;
Collection<?> param = (Collection<?>) params.getParameter(
CookieSpecPNames.DATE_PATTERNS);
if (param != null) {
patterns = new String[param.size()];
patterns = param.toArray(patterns);
}
boolean singleHeader = params.getBooleanParameter(
CookieSpecPNames.SINGLE_COOKIE_HEADER, false);
return new RFC2965Spec(patterns, singleHeader);
} else {
return new RFC2965Spec();
}
}
示例4: getCredentialCharset
import org.apache.http.params.HttpParams; //导入方法依赖的package包/类
/**
* Obtains the charset for encoding
* {@link org.apache.http.auth.Credentials}.If not configured,
* {@link HTTP#DEFAULT_PROTOCOL_CHARSET}is used instead.
*
* @return The charset
*/
public static String getCredentialCharset(final HttpParams params) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
}
String charset = (String) params.getParameter
(AuthPNames.CREDENTIAL_CHARSET);
if (charset == null) {
charset = HTTP.DEF_PROTOCOL_CHARSET.name();
}
return charset;
}
示例5: getCookiePolicy
import org.apache.http.params.HttpParams; //导入方法依赖的package包/类
public static String getCookiePolicy(final HttpParams params) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
}
String cookiePolicy = (String)
params.getParameter(ClientPNames.COOKIE_POLICY);
if (cookiePolicy == null) {
return CookiePolicy.BEST_MATCH;
}
return cookiePolicy;
}
示例6: getConnectionManagerTimeout
import org.apache.http.params.HttpParams; //导入方法依赖的package包/类
/**
* Get the connectiion manager timeout value.
* This is defined by the parameter {@code ClientPNames.CONN_MANAGER_TIMEOUT}.
* Failing that it uses the parameter {@code CoreConnectionPNames.CONNECTION_TIMEOUT}
* which defaults to 0 if not defined.
*
* @since 4.2
* @return the timeout value
*/
public static long getConnectionManagerTimeout(final HttpParams params) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
}
Long timeout = (Long) params.getParameter(ClientPNames.CONN_MANAGER_TIMEOUT);
if (timeout != null) {
return timeout.longValue();
}
return HttpConnectionParams.getConnectionTimeout(params);
}
示例7: newInstance
import org.apache.http.params.HttpParams; //导入方法依赖的package包/类
public CookieSpec newInstance(final HttpParams params) {
if (params != null) {
String[] patterns = null;
Collection<?> param = (Collection<?>) params.getParameter(
CookieSpecPNames.DATE_PATTERNS);
if (param != null) {
patterns = new String[param.size()];
patterns = param.toArray(patterns);
}
return new NetscapeDraftSpec(patterns);
} else {
return new NetscapeDraftSpec();
}
}
示例8: newInstance
import org.apache.http.params.HttpParams; //导入方法依赖的package包/类
public CookieSpec newInstance(final HttpParams params) {
if (params != null) {
String[] patterns = null;
Collection<?> param = (Collection<?>) params.getParameter(
CookieSpecPNames.DATE_PATTERNS);
if (param != null) {
patterns = new String[param.size()];
patterns = param.toArray(patterns);
}
return new BrowserCompatSpec(patterns);
} else {
return new BrowserCompatSpec();
}
}
示例9: getMaxConnectionsPerRoute
import org.apache.http.params.HttpParams; //导入方法依赖的package包/类
/**
* Returns lookup interface for maximum number of connections allowed per route.
*
* @param params HTTP parameters
*
* @return lookup interface for maximum number of connections allowed per route.
*/
public static ConnPerRoute getMaxConnectionsPerRoute(final HttpParams params) {
if (params == null) {
throw new IllegalArgumentException
("HTTP parameters must not be null.");
}
ConnPerRoute connPerRoute = (ConnPerRoute) params.getParameter(MAX_CONNECTIONS_PER_ROUTE);
if (connPerRoute == null) {
connPerRoute = DEFAULT_CONN_PER_ROUTE;
}
return connPerRoute;
}
示例10: getDefaultProxy
import org.apache.http.params.HttpParams; //导入方法依赖的package包/类
/**
* Obtains the {@link ConnRoutePNames#DEFAULT_PROXY DEFAULT_PROXY}
* parameter value.
* {@link #NO_HOST} will be mapped to <code>null</code>,
* to allow unsetting in a hierarchy.
*
* @param params the parameters in which to look up
*
* @return the default proxy set in the argument parameters, or
* <code>null</code> if not set
*/
public static HttpHost getDefaultProxy(HttpParams params) {
if (params == null) {
throw new IllegalArgumentException("Parameters must not be null.");
}
HttpHost proxy = (HttpHost)
params.getParameter(DEFAULT_PROXY);
if ((proxy != null) && NO_HOST.equals(proxy)) {
// value is explicitly unset
proxy = null;
}
return proxy;
}
示例11: getForcedRoute
import org.apache.http.params.HttpParams; //导入方法依赖的package包/类
/**
* Obtains the {@link ConnRoutePNames#FORCED_ROUTE FORCED_ROUTE}
* parameter value.
* {@link #NO_ROUTE} will be mapped to <code>null</code>,
* to allow unsetting in a hierarchy.
*
* @param params the parameters in which to look up
*
* @return the forced route set in the argument parameters, or
* <code>null</code> if not set
*/
public static HttpRoute getForcedRoute(HttpParams params) {
if (params == null) {
throw new IllegalArgumentException("Parameters must not be null.");
}
HttpRoute route = (HttpRoute)
params.getParameter(FORCED_ROUTE);
if ((route != null) && NO_ROUTE.equals(route)) {
// value is explicitly unset
route = null;
}
return route;
}
示例12: getLocalAddress
import org.apache.http.params.HttpParams; //导入方法依赖的package包/类
/**
* Obtains the {@link ConnRoutePNames#LOCAL_ADDRESS LOCAL_ADDRESS}
* parameter value.
* There is no special value that would automatically be mapped to
* <code>null</code>. You can use the wildcard address (0.0.0.0 for IPv4,
* :: for IPv6) to override a specific local address in a hierarchy.
*
* @param params the parameters in which to look up
*
* @return the local address set in the argument parameters, or
* <code>null</code> if not set
*/
public static InetAddress getLocalAddress(HttpParams params) {
if (params == null) {
throw new IllegalArgumentException("Parameters must not be null.");
}
InetAddress local = (InetAddress)
params.getParameter(LOCAL_ADDRESS);
// no explicit unsetting
return local;
}