下面列出了怎么用org.apache.http.conn.SchemePortResolver的API类实例代码及写法,或者点击链接到github查看源代码。
public ExtendedConnectionOperator(
Lookup<ConnectionSocketFactory> socketFactoryRegistry,
SchemePortResolver schemePortResolver,
DnsResolver dnsResolver
) {
this.socketFactoryRegistry = socketFactoryRegistry;
this.schemePortResolver = schemePortResolver != null ? schemePortResolver : DefaultSchemePortResolver.INSTANCE;
this.dnsResolver = dnsResolver != null ? dnsResolver : SystemDefaultDnsResolver.INSTANCE;
}
/**
* Initilisation procedure for this test case.
*
* @throws UnableToBuildSolRDFClientException in case the client cannot be built.
* @throws Exception in case of Solr startup failure.
*/
@BeforeClass
public static void initITTest() {
System.setProperty("tests.asserts", "false");
System.setProperty("jetty.port", "8080");
System.setProperty("solr.core.name", "store");
System.setProperty("solr.data.dir", initCoreDataDir.getAbsolutePath());
try {
SOLR = createJetty(
"target/solrdf-integration-tests-1.1-dev/solrdf",
JettyConfig.builder()
.setPort(8080)
.setContext("/solr")
.stopAtShutdown(true)
.build());
final HttpClient httpClient = HttpClientBuilder.create()
.setRoutePlanner(
new DefaultRoutePlanner(
new SchemePortResolver() {
@Override
public int resolve(final HttpHost host) throws UnsupportedSchemeException {
return SOLR.getLocalPort();
}
})).build();
SOLRDF_CLIENT = SolRDF.newBuilder()
.withEndpoint("http://127.0.0.1:8080/solr/store")
.withGraphStoreProtocolEndpointPath("/rdf-graph-store")
.withHttpClient(httpClient)
.withSPARQLEndpointPath("/sparql")
.build();
PLAIN_SOLR_CLIENT = new HttpSolrClient(SOLR_URI);
} catch (final Exception exception) {
throw new RuntimeException(exception);
}
}
public HTTPAuthCache(final SchemePortResolver schemePortResolver) {
super(schemePortResolver);
}
@Alias
public BasicAuthCacheAlias(final SchemePortResolver schemePortResolver) {
}
public NoSerializationBasicAuthCache(final SchemePortResolver schemePortResolver) {
this.map = new ConcurrentHashMap<>();
this.schemePortResolver = schemePortResolver != null ? schemePortResolver
: DefaultSchemePortResolver.INSTANCE;
}