本文整理汇总了Java中org.apache.http.client.fluent.Executor.auth方法的典型用法代码示例。如果您正苦于以下问题:Java Executor.auth方法的具体用法?Java Executor.auth怎么用?Java Executor.auth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.http.client.fluent.Executor
的用法示例。
在下文中一共展示了Executor.auth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reload
import org.apache.http.client.fluent.Executor; //导入方法依赖的package包/类
public void reload(boolean initial) {
if ( initial ) {
Runnable onChange = new Runnable() {
@Override
public void run() {
reload(false);
}
};
INDEX_URL.addCallback(onChange);
INDEX_USER.addCallback(onChange);
INDEX_PASS.addCallback(onChange);
}
log.info("Using docker index url [{}] and user [{}]", INDEX_URL.get(), INDEX_USER.get());
Executor executor = Executor.newInstance();
if ( ! StringUtils.isBlank(INDEX_USER.get()) ) {
executor = executor.auth(INDEX_USER.get(), INDEX_PASS.get());
}
this.executor = executor;
}
示例2: invokeRequest
import org.apache.http.client.fluent.Executor; //导入方法依赖的package包/类
public static HttpResponse invokeRequest(Request request, String username, String password, boolean useSSL) throws ClientProtocolException, IOException, KeyManagementException, NoSuchAlgorithmException {
Executor executor = getExecutor(useSSL);
executor = executor.auth(username, password);
HttpResponse httpResponse = invokeRequest(request, executor);
return httpResponse;
}
示例3: createExecutor
import org.apache.http.client.fluent.Executor; //导入方法依赖的package包/类
private static Executor createExecutor(ClientConfig config) {
Executor retval = Executor.newInstance();
retval.auth(config.getEndpointHost(), config.getUsername(), config.getPassword());
if (config.hasProxy() && config.isProxyAuthenticated()) {
retval.auth(config.getProxyHost(), config.getProxyUsername(), config.getProxyPassword());
}
return retval;
}
示例4: setupProxy
import org.apache.http.client.fluent.Executor; //导入方法依赖的package包/类
public static Executor setupProxy(Executor exec, URI uri) {
for (IProxyData d : proxyService.select(uri)) {
exec.auth(new HttpHost(d.getHost(), d.getPort()), getCredentials(d));
exec.authPreemptiveProxy(new HttpHost(d.getHost(), d.getPort()));
break;
}
executors.put(exec, uri);
return exec;
}