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 booleandefaultUseHttp1_1protected 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()longgetConnectionTimeoutMillis()longgetIdleTimeoutMillis()longgetRequestTimeoutMillis()booleanshouldUseHttp1_1()Return whether the HttpSolrClient built will prefer http1.1 over http2.BuseHttp1_1(boolean useHttp1_1)If true, prefer http1.1 over http2.BwithBasicAuthCredentials(String user, String pass)BwithConnectionTimeout(long connectionTimeout, TimeUnit unit)The max time a connection can take to connect to destinations.BwithDefaultCollection(String defaultCoreOrCollection)Sets a default for core or collection based requests.BwithExecutor(ExecutorService executor)BwithFollowRedirects(boolean followRedirects)BwithIdleTimeout(long idleConnectionTimeout, TimeUnit unit)The max time a connection can be idle (that is, without traffic of bytes in either direction).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 for requests to receive a response.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
-
defaultUseHttp1_1
protected final boolean defaultUseHttp1_1
-
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
-
withIdleTimeout
public B withIdleTimeout(long idleConnectionTimeout, TimeUnit unit)
The max time a connection can be idle (that is, without traffic of bytes in either direction). Sometimes called a "socket timeout". Note: not applicable to the JDK HttpClient.
-
getIdleTimeoutMillis
public long getIdleTimeoutMillis()
-
withConnectionTimeout
public B withConnectionTimeout(long connectionTimeout, TimeUnit unit)
The max time a connection can take to connect to destinations.
-
getConnectionTimeoutMillis
public long getConnectionTimeoutMillis()
-
withRequestTimeout
public B withRequestTimeout(long requestTimeout, TimeUnit unit)
Set a timeout for requests to receive a response.
-
getRequestTimeoutMillis
public long getRequestTimeoutMillis()
-
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
-
shouldUseHttp1_1
public boolean shouldUseHttp1_1()
Return whether the HttpSolrClient built will prefer http1.1 over http2.- Returns:
- whether to prefer http1.1
-
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
-
-