當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpSolrServer.setFollowRedirects方法代碼示例

本文整理匯總了Java中org.apache.solr.client.solrj.impl.HttpSolrServer.setFollowRedirects方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpSolrServer.setFollowRedirects方法的具體用法?Java HttpSolrServer.setFollowRedirects怎麽用?Java HttpSolrServer.setFollowRedirects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.solr.client.solrj.impl.HttpSolrServer的用法示例。


在下文中一共展示了HttpSolrServer.setFollowRedirects方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getNewHttpSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //導入方法依賴的package包/類
/**
 * 
 * @param indexUrl
 * @return
 */
public static HttpSolrServer getNewHttpSolrServer(String indexUrl) {
    if (indexUrl == null) {
        throw new IllegalArgumentException("indexUrl may not be null");
    }
    HttpSolrServer server = new HttpSolrServer(indexUrl);
    server.setSoTimeout(TIMEOUT_SO); // socket read timeout
    server.setConnectionTimeout(TIMEOUT_CONNECTION);
    server.setDefaultMaxConnectionsPerHost(100);
    server.setMaxTotalConnections(100);
    server.setFollowRedirects(false); // defaults to false
    server.setAllowCompression(true);
    server.setMaxRetries(1); // defaults to 0. > 1 not recommended.
    // server.setParser(new XMLResponseParser()); // binary parser is used by default
    server.setRequestWriter(new BinaryRequestWriter());

    return server;
}
 
開發者ID:intranda,項目名稱:goobi-viewer-connector,代碼行數:23,代碼來源:SolrSearchIndex.java

示例2: getSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //導入方法依賴的package包/類
public static synchronized SolrServer getSolrServer(String url) {
	SolrServer server = servers.get(url);
	if(server == null) {
		logger.info("Connecting to Solr: " + url);
		HttpSolrServer httpServer = new HttpSolrServer(url);
		httpServer.setSoTimeout(Integer.parseInt(SolrMeterConfiguration.getProperty("solr.server.configuration.soTimeout", "60000"))); // socket read timeout
		httpServer.setConnectionTimeout(Integer.parseInt(SolrMeterConfiguration.getProperty("solr.server.configuration.connectionTimeout", "60000")));
		httpServer.setDefaultMaxConnectionsPerHost(Integer.parseInt(SolrMeterConfiguration.getProperty("solr.server.configuration.defaultMaxConnectionsPerHost", "100000")));
		httpServer.setMaxTotalConnections(Integer.parseInt(SolrMeterConfiguration.getProperty("solr.server.configuration.maxTotalConnections", "1000000")));
		httpServer.setFollowRedirects(Boolean.parseBoolean(SolrMeterConfiguration.getProperty("solr.server.configuration.followRedirect", "false"))); // defaults to false
		httpServer.setAllowCompression(Boolean.parseBoolean(SolrMeterConfiguration.getProperty("solr.server.configuration.allowCompression", "true")));
		httpServer.setMaxRetries(Integer.parseInt(SolrMeterConfiguration.getProperty("solr.server.configuration.maxRetries", "1"))); // defaults to 0. > 1 not recommended.
		setAuthentication(httpServer);
		servers.put(url, httpServer);
		return httpServer;

	}
	return server;
}
 
開發者ID:lafourchette,項目名稱:solrmeter,代碼行數:20,代碼來源:SolrServerRegistry.java

示例3: getNewHttpSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //導入方法依賴的package包/類
public static HttpSolrServer getNewHttpSolrServer(String confFilename) throws FatalIndexerException {
    HttpSolrServer server = new HttpSolrServer(Configuration.getInstance(confFilename).getConfiguration("solrUrl"));
    server.setSoTimeout(TIMEOUT_SO); // socket read timeout
    server.setConnectionTimeout(TIMEOUT_CONNECTION);
    server.setDefaultMaxConnectionsPerHost(100);
    server.setMaxTotalConnections(100);
    server.setFollowRedirects(false); // defaults to false
    server.setAllowCompression(true);
    server.setMaxRetries(1); // defaults to 0. > 1 not recommended.
    // server.setParser(new XMLResponseParser()); // binary parser is used by default
    server.setRequestWriter(new BinaryRequestWriter());

    return server;
}
 
開發者ID:intranda,項目名稱:goobi-viewer-indexer,代碼行數:15,代碼來源:SolrHelper.java


注:本文中的org.apache.solr.client.solrj.impl.HttpSolrServer.setFollowRedirects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。