org.eclipse.jetty.client.HttpClient.setRealmResolver()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中org.eclipse.jetty.client.HttpClient.setRealmResolver()方法的一些代码示例,展示了HttpClient.setRealmResolver()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.setRealmResolver()方法的具体详情如下:
包路径:org.eclipse.jetty.client.HttpClient
类名称:HttpClient
方法名:setRealmResolver

HttpClient.setRealmResolver介绍

[英]Set a RealmResolver for client Authentication. If a realmResolver is set, then the HttpDestinations created by this client will instantiate a SecurityListener so that BASIC and DIGEST authentication can be performed.
[中]为客户端身份验证设置RealmResolver。如果设置了realmResolver,则此客户端创建的HttpDestinations将实例化SecurityListener,以便可以执行基本和摘要身份验证。

代码示例

代码示例来源:origin: org.sonatype.nexus/nexus-indexer

if ( authInfo != null && authInfo.getUserName() != null )
  httpClient.setRealmResolver( new RealmResolver()

代码示例来源:origin: net.anthavio/hatatitla

public HttpClient buildHttpClient() {
  HttpClient client = new HttpClient();
  //client.setConnectBlocking(false);
  client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
  client.setConnectTimeout(getConnectTimeoutMillis());
  client.setTimeout(getReadTimeoutMillis());
  client.setMaxConnectionsPerAddress(getPoolMaximumSize());
  client.setThreadPool(new QueuedThreadPool(getPoolMaximumSize()));
  //client.setIdleTimeout(config.get???);
  if (getFollowRedirects()) {
    client.setMaxRedirects(10);
  }
  if (getAuthentication() != null) {
    Realm realm = new SimpleRealm("whatever", getAuthentication().getUsername(), getAuthentication().getPassword());
    client.setRealmResolver(new SimpleRealmResolver(realm));
  }
  return client;
}

代码示例来源:origin: org.apache.servicemix/servicemix-http

jettyClient.setMaxConnectionsPerAddress(getMaxConnectionsPerAddress());
if (principal != null && credentials != null) {
  jettyClient.setRealmResolver(new SimpleRealmResolver(new Realm() {
    public String getPrincipal() {
      return principal;

相关文章

HttpClient类方法