Class HttpSolrClientBuilderBase<B extends HttpSolrClientBuilderBase<?,?>,C extends HttpSolrClientBase>
- java.lang.Object
-
- org.apache.solr.client.solrj.impl.HttpSolrClientBuilderBase<B,C>
-
- Direct Known Subclasses:
Http2SolrClient.Builder,HttpJdkSolrClient.Builder
public abstract class HttpSolrClientBuilderBase<B extends HttpSolrClientBuilderBase<?,?>,C extends HttpSolrClientBase> extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected StringbaseSolrUrlprotected StringbasicAuthAuthorizationStrprotected LongconnectionTimeoutMillisprotected StringdefaultCollectionprotected ExecutorServiceexecutorprotected BooleanfollowRedirectsprotected LongidleTimeoutMillisprotected IntegermaxConnectionsPerHostprotected StringproxyHostprotected booleanproxyIsSecureprotected booleanproxyIsSocks4protected intproxyPortprotected LongrequestTimeoutMillisprotected RequestWriterrequestWriterprotected ResponseParserresponseParserprotected Set<String>urlParamNamesprotected booleanuseHttp1_1
-
Constructor Summary
Constructors Constructor Description HttpSolrClientBuilderBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Cbuild()LonggetConnectionTimeout()LonggetIdleTimeoutMillis()BuseHttp1_1(boolean useHttp1_1)If true, prefer http1.1 over http2.BwithBasicAuthCredentials(String user, String pass)BwithConnectionTimeout(long connectionTimeout, TimeUnit unit)BwithDefaultCollection(String defaultCoreOrCollection)Sets a default for core or collection based requests.BwithExecutor(ExecutorService executor)BwithFollowRedirects(boolean followRedirects)BwithIdleTimeout(long idleConnectionTimeout, TimeUnit unit)BwithMaxConnectionsPerHost(int max)Set maxConnectionsPerHost for http1 connections, maximum number http2 connections is limited to 4BwithOptionalBasicAuthCredentials(String credentials)Setup basic authentication from a string formatted as username:password.BwithProxyConfiguration(String host, int port, boolean isSocks4, boolean isSecure)Setup a proxyBwithRequestTimeout(long requestTimeout, TimeUnit unit)Set a timeout in milliseconds for requests issued by this client.BwithRequestWriter(RequestWriter requestWriter)Provides aRequestWriterfor created clients to use when handing requests.BwithResponseParser(ResponseParser responseParser)Provides aResponseParserfor created clients to use when handling requests.BwithTheseParamNamesInTheUrl(Set<String> urlParamNames)Expert Method
-
-
-
Field Detail
-
idleTimeoutMillis
protected Long idleTimeoutMillis
-
connectionTimeoutMillis
protected Long connectionTimeoutMillis
-
requestTimeoutMillis
protected Long requestTimeoutMillis
-
basicAuthAuthorizationStr
protected String basicAuthAuthorizationStr
-
followRedirects
protected Boolean followRedirects
-
baseSolrUrl
protected String baseSolrUrl
-
requestWriter
protected RequestWriter requestWriter
-
responseParser
protected ResponseParser responseParser
-
defaultCollection
protected String defaultCollection
-
maxConnectionsPerHost
protected Integer maxConnectionsPerHost
-
executor
protected ExecutorService executor
-
useHttp1_1
protected boolean useHttp1_1
-
proxyHost
protected String proxyHost
-
proxyPort
protected int proxyPort
-
proxyIsSocks4
protected boolean proxyIsSocks4
-
proxyIsSecure
protected boolean proxyIsSecure
-
-
Method Detail
-
build
public abstract C build()
-
withRequestWriter
public B withRequestWriter(RequestWriter requestWriter)
Provides aRequestWriterfor created clients to use when handing requests.
-
withResponseParser
public B withResponseParser(ResponseParser responseParser)
Provides aResponseParserfor created clients to use when handling requests.
-
withDefaultCollection
public B withDefaultCollection(String defaultCoreOrCollection)
Sets a default for core or collection based requests.
-
withFollowRedirects
public B withFollowRedirects(boolean followRedirects)
-
withExecutor
public B withExecutor(ExecutorService executor)
-
withTheseParamNamesInTheUrl
public B withTheseParamNamesInTheUrl(Set<String> urlParamNames)
Expert Method- Parameters:
urlParamNames- set of param keys that are only sent via the query string. Note that the param will be sent as a query string if the key is part of this Set or the SolrRequest's query params.- See Also:
SolrRequest.getQueryParams()
-
withMaxConnectionsPerHost
public B withMaxConnectionsPerHost(int max)
Set maxConnectionsPerHost for http1 connections, maximum number http2 connections is limited to 4
-
getIdleTimeoutMillis
public Long getIdleTimeoutMillis()
-
getConnectionTimeout
public Long getConnectionTimeout()
-
withRequestTimeout
public B withRequestTimeout(long requestTimeout, TimeUnit unit)
Set a timeout in milliseconds for requests issued by this client.- Parameters:
requestTimeout- The timeout in milliseconds- Returns:
- this Builder.
-
useHttp1_1
public B useHttp1_1(boolean useHttp1_1)
If true, prefer http1.1 over http2. If not set, the default is determined by system property 'solr.http1'. Otherwise, false.- Parameters:
useHttp1_1- prefer http1.1?- Returns:
- this Builder
-
withProxyConfiguration
public B withProxyConfiguration(String host, int port, boolean isSocks4, boolean isSecure)
Setup a proxy- Parameters:
host- The proxy hostport- The proxy portisSocks4- If true creates an SOCKS 4 proxy, otherwise creates an HTTP proxyisSecure- If true enables the secure flag on the proxy- Returns:
- this Builder
-
withOptionalBasicAuthCredentials
public B withOptionalBasicAuthCredentials(String credentials)
Setup basic authentication from a string formatted as username:password. If the string is Null then it doesn't do anything.- Parameters:
credentials- The username and password formatted as username:password- Returns:
- this Builder
-
-