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 String
baseSolrUrl
protected String
basicAuthAuthorizationStr
protected Long
connectionTimeoutMillis
protected String
defaultCollection
protected ExecutorService
executor
protected Boolean
followRedirects
protected Long
idleTimeoutMillis
protected Integer
maxConnectionsPerHost
protected String
proxyHost
protected boolean
proxyIsSecure
protected boolean
proxyIsSocks4
protected int
proxyPort
protected Long
requestTimeoutMillis
protected RequestWriter
requestWriter
protected ResponseParser
responseParser
protected Set<String>
urlParamNames
protected boolean
useHttp1_1
-
Constructor Summary
Constructors Constructor Description HttpSolrClientBuilderBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract C
build()
Long
getConnectionTimeout()
Long
getIdleTimeoutMillis()
B
useHttp1_1(boolean useHttp1_1)
If true, prefer http1.1 over http2.B
withBasicAuthCredentials(String user, String pass)
B
withConnectionTimeout(long connectionTimeout, TimeUnit unit)
B
withDefaultCollection(String defaultCoreOrCollection)
Sets a default for core or collection based requests.B
withExecutor(ExecutorService executor)
B
withFollowRedirects(boolean followRedirects)
B
withIdleTimeout(long idleConnectionTimeout, TimeUnit unit)
B
withMaxConnectionsPerHost(int max)
Set maxConnectionsPerHost for http1 connections, maximum number http2 connections is limited to 4B
withOptionalBasicAuthCredentials(String credentials)
Setup basic authentication from a string formatted as username:password.B
withProxyConfiguration(String host, int port, boolean isSocks4, boolean isSecure)
Setup a proxyB
withRequestTimeout(long requestTimeout, TimeUnit unit)
Set a timeout in milliseconds for requests issued by this client.B
withRequestWriter(RequestWriter requestWriter)
Provides aRequestWriter
for created clients to use when handing requests.B
withResponseParser(ResponseParser responseParser)
Provides aResponseParser
for created clients to use when handling requests.B
withTheseParamNamesInTheUrl(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 aRequestWriter
for created clients to use when handing requests.
-
withResponseParser
public B withResponseParser(ResponseParser responseParser)
Provides aResponseParser
for 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
-
-