本文整理了Java中org.apache.http.util.Args.check()
方法的一些代码示例,展示了Args.check()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Args.check()
方法的具体详情如下:
包路径:org.apache.http.util.Args
类名称:Args
方法名:check
暂无
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient
/**
* Sets the factor to use when backing off; the new
* per-host limit will be roughly the current max times
* this factor. <code>Math.floor</code> is applied in the
* case of non-integer outcomes to ensure we actually
* decrease the pool size. Pool sizes are never decreased
* below 1, however. Defaults to 0.5.
* @param d must be between 0.0 and 1.0, exclusive.
*/
public void setBackoffFactor(final double d) {
Args.check(d > 0.0 && d < 1.0, "Backoff factor must be 0.0 < f < 1.0");
backoffFactor = d;
}
代码示例来源:origin: org.zalando.stups/stups-http-components-oauth2
public AccessTokensRequestInterceptor(final String tokenId, final AccessTokens accessTokens) {
Args.check(tokenId != null, "'tokenId' should never be null");
Args.check(accessTokens != null, "'accessTokens' should never be null");
Args.check(!tokenId.trim().isEmpty(), "'tokenId' should never be empty");
this.tokenId = tokenId;
this.accessTokens = accessTokens;
}
代码示例来源:origin: ibinti/bugvm
@Override
public final HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
if (hop < hopcount - 1) {
return this.proxyChain.get(hop);
} else {
return this.targetHost;
}
}
代码示例来源:origin: com.bugvm/bugvm-rt
@Override
public final HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
if (hop < hopcount - 1) {
return this.proxyChain.get(hop);
} else {
return this.targetHost;
}
}
代码示例来源:origin: com.hynnet/httpclient
@Override
public final HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
if (hop < hopcount - 1) {
return this.proxyChain.get(hop);
} else {
return this.targetHost;
}
}
代码示例来源:origin: com.jsunsoft.http/http-request
/**
* Parameters needs to be add for all requests.
*
* @param nameValues nameValues
* @return HttpRequestBuilder instance
*/
public HttpRequestBuilder<T> addDefaultRequestParameter(NameValuePair... nameValues) {
int nameValuesLength = ArgsCheck.notNull(nameValues, "nameValues").length;
Args.check(nameValuesLength != 0, "Length of parameter can't be ZERO");
return addDefaultRequestParameter(Arrays.asList(nameValues));
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient
public final HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
if (hop < hopcount - 1) {
return this.proxyChain.get(hop);
} else {
return this.targetHost;
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
@Override
public final HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
if (hop < hopcount - 1) {
return this.proxyChain.get(hop);
} else {
return this.targetHost;
}
}
代码示例来源:origin: Nextdoor/bender
@Override
public final HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
if (hop < hopcount - 1) {
return this.proxyChain.get(hop);
} else {
return this.targetHost;
}
}
代码示例来源:origin: Nextdoor/bender
/**
* Indicates creation of an entry for this pool.
* The entry will <i>not</i> be added to the list of free entries,
* it is only recognized as belonging to this pool now. It can then
* be passed to {@link #freeEntry freeEntry}.
*
* @param entry the entry that was created for this pool
*/
public void createdEntry(final BasicPoolEntry entry) {
Args.check(route.equals(entry.getPlannedRoute()), "Entry not planned for this pool");
numEntries++;
}
代码示例来源:origin: com.hynnet/httpclient
/**
* Indicates creation of an entry for this pool.
* The entry will <i>not</i> be added to the list of free entries,
* it is only recognized as belonging to this pool now. It can then
* be passed to {@link #freeEntry freeEntry}.
*
* @param entry the entry that was created for this pool
*/
public void createdEntry(final BasicPoolEntry entry) {
Args.check(route.equals(entry.getPlannedRoute()), "Entry not planned for this pool");
numEntries++;
}
代码示例来源:origin: com.jsunsoft.http/http-request
/**
* Created Builder to build BasicHttpRequest to post request
*
* @param uri {@link URI} instance to request
* @param type Class type to resolve successful response type. Example {@code String.class}
* @param <T> Type of expected successful response
* @return Builder instance
*/
public static <T> HttpRequestBuilder<T> createPost(URI uri, Class<T> type) {
Args.check(!HttpRequestUtils.isVoidType(type), TYPE_CANNOT_BE_VOID);
return new HttpRequestBuilder<>(HttpPost.METHOD_NAME, uri, type);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient
/**
* Indicates creation of an entry for this pool.
* The entry will <i>not</i> be added to the list of free entries,
* it is only recognized as belonging to this pool now. It can then
* be passed to {@link #freeEntry freeEntry}.
*
* @param entry the entry that was created for this pool
*/
public void createdEntry(final BasicPoolEntry entry) {
Args.check(route.equals(entry.getPlannedRoute()), "Entry not planned for this pool");
numEntries++;
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient
public final HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
HttpHost result = null;
if (hop < hopcount-1) {
result = this.proxyChain[hop];
} else {
result = this.targetHost;
}
return result;
}
代码示例来源:origin: com.jsunsoft.http/http-request
/**
* Created Builder to build BasicHttpRequest to post request
*
* @param uri uri to request
* @param type Class type to resolve successful response type. Example {@code String.class}
* @param <T> Type of expected successful response
* @return Builder instance
*/
public static <T> HttpRequestBuilder<T> createPost(String uri, Class<T> type) {
Args.check(!HttpRequestUtils.isVoidType(type), TYPE_CANNOT_BE_VOID);
return new HttpRequestBuilder<>(HttpPost.METHOD_NAME, uri, type);
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* Indicates creation of an entry for this pool.
* The entry will <i>not</i> be added to the list of free entries,
* it is only recognized as belonging to this pool now. It can then
* be passed to {@link #freeEntry freeEntry}.
*
* @param entry the entry that was created for this pool
*/
public void createdEntry(final BasicPoolEntry entry) {
Args.check(route.equals(entry.getPlannedRoute()), "Entry not planned for this pool");
numEntries++;
}
代码示例来源:origin: com.jsunsoft.http/http-request
/**
* Created Builder to build BasicHttpRequest to get request
*
* @param uri {@link URI} instance to request
* @param typeReference instance to resolve successful response type if type is Generic. Example {@code new TypeReference<java.util.List<String>>(){}}
* @param <T> Type of expected successful response
* @return Builder instance
*/
public static <T> HttpRequestBuilder<T> createGet(URI uri, TypeReference<T> typeReference) {
Args.check(!HttpRequestUtils.isVoidType(typeReference.getType()), TYPE_CANNOT_BE_VOID);
return new HttpRequestBuilder<>(HttpGet.METHOD_NAME, uri, typeReference);
}
代码示例来源:origin: com.jsunsoft.http/http-request
/**
* Created Builder to build BasicHttpRequest to post request
*
* @param uri uri to request
* @param typeReference instance to resolve successful response type if type is Generic. Example {@code new TypeReference<java.util.List<String>>(){}}
* @param <T> Type of expected successful response
* @return Builder instance
*/
public static <T> HttpRequestBuilder<T> createPost(String uri, TypeReference<T> typeReference) {
Args.check(!HttpRequestUtils.isVoidType(typeReference.getType()), TYPE_CANNOT_BE_VOID);
return new HttpRequestBuilder<>(HttpPost.METHOD_NAME, uri, typeReference);
}
代码示例来源:origin: com.jsunsoft.http/http-request
/**
* Created Builder to build BasicHttpRequest to get request
*
* @param uri uri to request
* @param typeReference instance to resolve successful response type if type is Generic. Example {@code new TypeReference<java.util.List<String>>(){}}
* @param <T> Type of expected successful response
* @return Builder instance
*/
public static <T> HttpRequestBuilder<T> createGet(String uri, TypeReference<T> typeReference) {
Args.check(!HttpRequestUtils.isVoidType(typeReference.getType()), TYPE_CANNOT_BE_VOID);
return new HttpRequestBuilder<>(HttpGet.METHOD_NAME, uri, typeReference);
}
代码示例来源:origin: com.jsunsoft.http/http-request
/**
* Created Builder to build BasicHttpRequest to post request
*
* @param uri {@link URI} instance to request
* @param typeReference instance to resolve successful response type if type is Generic. Example {@code new TypeReference<java.util.List<String>>(){}}
* @param <T> Type of expected successful response
* @return Builder instance
*/
public static <T> HttpRequestBuilder<T> createPost(URI uri, TypeReference<T> typeReference) {
Args.check(!HttpRequestUtils.isVoidType(typeReference.getType()), TYPE_CANNOT_BE_VOID);
return new HttpRequestBuilder<>(HttpPost.METHOD_NAME, uri, typeReference);
}
内容来源于网络,如有侵权,请联系作者删除!