Package org.apache.solr.client.solrj.impl

# Class HttpSolrClientBuilderBase<B extends HttpSolrClientBuilderBase<?,?>,C extends HttpSolrClientBase>

java.lang.Object
org.apache.solr.client.solrj.impl.HttpSolrClientBuilderBase<B,C>

Direct Known Subclasses:
  `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 final boolean`
`defaultUseHttp1_1`
`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

Modifier and Type
Method
Description
`abstract C`
`build()`
`long`
`getConnectionTimeoutMillis()`
`ExecutorService`
`getExecutor()`
`Boolean`
`getFollowRedirects()`
`long`
`getIdleTimeoutMillis()`
`Integer`
`getMaxConnectionsPerHost()`
`String`
`getProxyHost()`
`int`
`getProxyPort()`
`long`
`getRequestTimeoutMillis()`
`boolean`
`isProxyIsSecure()`
`boolean`
`isProxyIsSocks4()`
`boolean`
`shouldUseHttp1_1()`
Return whether the HttpSolrClient built will prefer http1.1 over http2.
`B`
`useHttp1_1(boolean useHttp1_1)`
If true, prefer http1.1 over http2.
`B`
`withBaseSolrUrl(String baseSolrUrl)`
Provides the Base Solr Url.
`B`
`withBasicAuthCredentials(String user, String pass)`
`B`
`withConnectionTimeout(long connectionTimeout, TimeUnit unit)`
The max time a connection can take to connect to destinations.
`B`
`withDefaultCollection(String defaultCoreOrCollection)`
Sets a default for core or collection based requests.
`B`
`withExecutor(ExecutorService executor)`
`B`
`withFollowRedirects(boolean followRedirects)`
`B`
`withHttpClient(C httpSolrClient)`
Provide a seed HttpSolrClient for the builder values, values can still be overridden by using builder methods
`B`
`withIdleTimeout(long idleConnectionTimeout, TimeUnit unit)`
The max time a connection can be idle (that is, without traffic of bytes in either direction).
`B`
`withMaxConnectionsPerHost(int max)`
Set maxConnectionsPerHost for http1 connections, maximum number http2 connections is limited to 4
`B`
`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 proxy
`B`
`withRequestTimeout(long requestTimeout, TimeUnit unit)`
Set a timeout for requests to receive a response.
`B`
`withRequestWriter(RequestWriter requestWriter)`
Provides a `RequestWriter` for created clients to use when handing requests.
`B`
`withResponseParser(ResponseParser responseParser)`
Provides a `ResponseParser` for created clients to use when handling requests.
`B`
`withTheseParamNamesInTheUrl(Set<String> urlParamNames)`
Expert Method

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### 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

### urlParamNames

protected Set<String> urlParamNames

### 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

## Constructor Details

### HttpSolrClientBuilderBase

public HttpSolrClientBuilderBase()

## Method Details

### build

public abstract C build()

### withHttpClient

public B withHttpClient(C httpSolrClient)
Provide a seed HttpSolrClient for the builder values, values can still be overridden by using builder methods

### withBaseSolrUrl

public B withBaseSolrUrl(String baseSolrUrl)
Provides the Base Solr Url.

### withRequestWriter

public B withRequestWriter(RequestWriter requestWriter)
Provides a `RequestWriter` for created clients to use when handing requests.

### withResponseParser

public B withResponseParser(ResponseParser responseParser)
Provides a `ResponseParser` 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)

### withBasicAuthCredentials

public B withBasicAuthCredentials(String user, String pass)

### 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 host
  `port` - The proxy port
  `isSocks4` - If true creates an SOCKS 4 proxy, otherwise creates an HTTP proxy
  `isSecure` - 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

### getMaxConnectionsPerHost

public Integer getMaxConnectionsPerHost()

### getFollowRedirects

public Boolean getFollowRedirects()

### getProxyHost

public String getProxyHost()

### getProxyPort

public int getProxyPort()

### isProxyIsSocks4

public boolean isProxyIsSocks4()

### isProxyIsSecure

public boolean isProxyIsSecure()

### getExecutor

public ExecutorService getExecutor()