## org.apache.solr.client.solrj.impl
Class CommonsHttpSolrServer

    java.lang.Object
      org.apache.solr.client.solrj.SolrServer
          org.apache.solr.client.solrj.impl.CommonsHttpSolrServer

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  StreamingUpdateSolrServer

Deprecated. Use `HttpSolrServer` instead.

    public class CommonsHttpSolrServer

extends SolrServer

The `CommonsHttpSolrServer` uses the Apache Commons HTTP Client to connect to solr.

    SolrServer server = new CommonsHttpSolrServer( url );

Since:
  solr 1.3
Version:
  $Id: CommonsHttpSolrServer.java 1305074 2012-03-25 16:30:58Z siren $
See Also:
  Serialized Form

Field Summary
`protected String` `_baseURL` Deprecated. The URL of the Solr server.
`protected ModifiableSolrParams` `_invariantParams` Deprecated. Default value: null / empty.
`protected ResponseParser` `_parser` Deprecated. Default response parser is BinaryResponseParser This parser represents the default Response Parser chosen to parse the response if the parser were not specified as part of the request.
`static String` `AGENT` Deprecated. User-Agent String as identified by the HTTP request by the `HttpClient` to the Solr server from the client.
`protected RequestWriter` `requestWriter` Deprecated. The RequestWriter used to write all requests to Solr

Constructor Summary
`CommonsHttpSolrServer(String solrServerUrl)` Deprecated.
`CommonsHttpSolrServer(String solrServerUrl, org.apache.commons.httpclient.HttpClient httpClient)` Deprecated. Talk to the Solr server via the given HttpClient.
`CommonsHttpSolrServer(String solrServerUrl, org.apache.commons.httpclient.HttpClient httpClient, boolean useMultiPartPost)` Deprecated.
`CommonsHttpSolrServer(String solrServerUrl, org.apache.commons.httpclient.HttpClient httpClient, ResponseParser parser)` Deprecated.
`CommonsHttpSolrServer(URL baseURL)` Deprecated.
`CommonsHttpSolrServer(URL baseURL, org.apache.commons.httpclient.HttpClient client)` Deprecated.
`CommonsHttpSolrServer(URL baseURL, org.apache.commons.httpclient.HttpClient client, boolean useMultiPartPost)` Deprecated.
`CommonsHttpSolrServer(URL baseURL, org.apache.commons.httpclient.HttpClient client, ResponseParser parser, boolean useMultiPartPost)` Deprecated.

Method Summary
`UpdateResponse` `add(Iterator<SolrInputDocument> docIterator)` Deprecated. Adds the documents supplied by the given iterator.
`UpdateResponse` `add(Iterator<SolrInputDocument> docIterator, int commitWithinMs)` Deprecated. Adds the documents supplied by the given iterator, specifying max time before they become committed
`UpdateResponse` `addBeans(Iterator<?> beanIterator)` Deprecated. Adds the beans supplied by the given iterator
`UpdateResponse` `addBeans(Iterator<?> beanIterator, int commitWithinMs)` Deprecated. Adds the beans supplied by the given iterator, specifying max time before they become committed
`String` `getBaseURL()` Deprecated.
`org.apache.commons.httpclient.HttpClient` `getHttpClient()` Deprecated.
`ModifiableSolrParams` `getInvariantParams()` Deprecated. Retrieve the default list of parameters are added to every request regardless.
`ResponseParser` `getParser()` Deprecated.
`NamedList<Object>` `request(SolrRequest request)` Deprecated. Process the request.
`NamedList<Object>` `request(SolrRequest request, ResponseParser processor)` Deprecated.
`void` `setAllowCompression(boolean allowCompression)` Deprecated. set allowCompression.
`void` `setBaseURL(String baseURL)` Deprecated.
`void` `setConnectionManagerTimeout(int timeout)` Deprecated. Use `setConnectionManagerTimeout(long)`
`void` `setConnectionManagerTimeout(long timeout)` Deprecated. Sets soTimeout (read timeout) on the underlying HttpConnectionManager.
`void` `setConnectionTimeout(int timeout)` Deprecated. set connectionTimeout on the underlying HttpConnectionManager
`void` `setDefaultMaxConnectionsPerHost(int connections)` Deprecated. set maxConnectionsPerHost on the underlying HttpConnectionManager
`void` `setFollowRedirects(boolean followRedirects)` Deprecated. set followRedirects.
`void` `setMaxRetries(int maxRetries)` Deprecated. set maximum number of retries to attempt in the event of transient errors.
`void` `setMaxTotalConnections(int connections)` Deprecated. set maxTotalConnection on the underlying HttpConnectionManager
`void` `setParser(ResponseParser processor)` Deprecated. Note: This setter method is not thread-safe.
`void` `setRequestWriter(RequestWriter requestWriter)` Deprecated.
`void` `setSoTimeout(int timeout)` Deprecated. Sets soTimeout (read timeout) on the underlying HttpConnectionManager.

Methods inherited from class org.apache.solr.client.solrj.SolrServer
`add, add, add, add, addBean, addBean, addBeans, addBeans, commit, commit, deleteById, deleteById, deleteById, deleteById, deleteByQuery, deleteByQuery, getBinder, optimize, optimize, optimize, ping, query, query, rollback`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### AGENT

    public static final String AGENT

  Deprecated.
  User-Agent String as identified by the HTTP request by the `HttpClient` to the Solr server from the client.

### _baseURL

    protected String _baseURL

  Deprecated.
  The URL of the Solr server.

### _invariantParams

    protected ModifiableSolrParams _invariantParams

  Deprecated.
  Default value: null / empty.

  Parameters that are added to every request regardless. This may be a place to add something like an authentication token.

### _parser

    protected ResponseParser _parser

  Deprecated.
  Default response parser is BinaryResponseParser

  This parser represents the default Response Parser chosen to parse the response if the parser were not specified as part of the request.

  See Also:
    `BinaryResponseParser`

### requestWriter

    protected RequestWriter requestWriter

  Deprecated.
  The RequestWriter used to write all requests to Solr

  See Also:
    `RequestWriter`

Constructor Detail

### CommonsHttpSolrServer

    public CommonsHttpSolrServer(String solrServerUrl)
                          throws MalformedURLException

  Deprecated.
  Parameters:
    `solrServerUrl` - The URL of the Solr server. For example, "`http://localhost:8983/solr/`" if you are using the standard distribution Solr webapp on your local machine.
  Throws:
    `MalformedURLException`

### CommonsHttpSolrServer

    public CommonsHttpSolrServer(String solrServerUrl,
                                 org.apache.commons.httpclient.HttpClient httpClient)
                          throws MalformedURLException

  Deprecated.
  Talk to the Solr server via the given HttpClient. The connection manager for the client should be a MultiThreadedHttpConnectionManager if this client is being reused across SolrServer instances, or of multiple threads will use this SolrServer.

  Throws:
    `MalformedURLException`

### CommonsHttpSolrServer

    public CommonsHttpSolrServer(String solrServerUrl,
                                 org.apache.commons.httpclient.HttpClient httpClient,
                                 boolean useMultiPartPost)
                          throws MalformedURLException

  Deprecated.
  Throws:
    `MalformedURLException`

### CommonsHttpSolrServer

    public CommonsHttpSolrServer(String solrServerUrl,
                                 org.apache.commons.httpclient.HttpClient httpClient,
                                 ResponseParser parser)
                          throws MalformedURLException

  Deprecated.
  Throws:
    `MalformedURLException`

### CommonsHttpSolrServer

    public CommonsHttpSolrServer(URL baseURL)

  Deprecated.
  Parameters:
    `baseURL` - The URL of the Solr server. For example, "`http://localhost:8983/solr/`" if you are using the standard distribution Solr webapp on your local machine.

### CommonsHttpSolrServer

    public CommonsHttpSolrServer(URL baseURL,
                                 org.apache.commons.httpclient.HttpClient client)

  Deprecated.

### CommonsHttpSolrServer

    public CommonsHttpSolrServer(URL baseURL,
                                 org.apache.commons.httpclient.HttpClient client,
                                 boolean useMultiPartPost)

  Deprecated.
  See Also:
    `useMultiPartPost`

### CommonsHttpSolrServer

    public CommonsHttpSolrServer(URL baseURL,
                                 org.apache.commons.httpclient.HttpClient client,
                                 ResponseParser parser,
                                 boolean useMultiPartPost)

  Deprecated.
  See Also:
    `useMultiPartPost`, `_parser`

Method Detail

### request

    public NamedList<Object> request(SolrRequest request)
                              throws SolrServerException,
                                     IOException

  Deprecated.
  Process the request. If `SolrRequest.getResponseParser()` is null, then use `getParser()`

  Specified by:
    `request` in class `SolrServer`
  Parameters:
    `request` - The `SolrRequest` to process
  Returns:
    The `NamedList` result
  Throws:
    `SolrServerException`
    `IOException`
  See Also:
    `request(org.apache.solr.client.solrj.SolrRequest, org.apache.solr.client.solrj.ResponseParser)`

### request

    public NamedList<Object> request(SolrRequest request,
                                     ResponseParser processor)
                              throws SolrServerException,
                                     IOException

  Deprecated.
  Throws:
    `SolrServerException`
    `IOException`

### getInvariantParams

    public ModifiableSolrParams getInvariantParams()

  Deprecated.
  Retrieve the default list of parameters are added to every request regardless.

  See Also:
    `_invariantParams`

### getBaseURL

    public String getBaseURL()

  Deprecated.

### setBaseURL

    public void setBaseURL(String baseURL)

  Deprecated.

### getParser

    public ResponseParser getParser()

  Deprecated.

### setParser

    public void setParser(ResponseParser processor)

  Deprecated.
  Note: This setter method is not thread-safe.

  Parameters:
    `processor` - Default Response Parser chosen to parse the response if the parser were not specified as part of the request.
  See Also:
    `SolrRequest.getResponseParser()`

### getHttpClient

    public org.apache.commons.httpclient.HttpClient getHttpClient()

  Deprecated.

### setConnectionTimeout

    public void setConnectionTimeout(int timeout)

  Deprecated.
  set connectionTimeout on the underlying HttpConnectionManager

  Parameters:
    `timeout` - Timeout in milliseconds

### setConnectionManagerTimeout

    @Deprecated
    public void setConnectionManagerTimeout(int timeout)

  Deprecated. Use `setConnectionManagerTimeout(long)`

  set connectionManagerTimeout on the HttpClient.

  Parameters:
    `timeout` - Timeout in milliseconds

### setConnectionManagerTimeout

    public void setConnectionManagerTimeout(long timeout)

  Deprecated.
  Sets soTimeout (read timeout) on the underlying HttpConnectionManager. This is desirable for queries, but probably not for indexing.

  Parameters:
    `timeout` - Timeout in milliseconds

### setSoTimeout

    public void setSoTimeout(int timeout)

  Deprecated.
  Sets soTimeout (read timeout) on the underlying HttpConnectionManager. This is desirable for queries, but probably not for indexing.

  Parameters:
    `timeout` - Timeout in milliseconds

### setDefaultMaxConnectionsPerHost

    public void setDefaultMaxConnectionsPerHost(int connections)

  Deprecated.
  set maxConnectionsPerHost on the underlying HttpConnectionManager

### setMaxTotalConnections

    public void setMaxTotalConnections(int connections)

  Deprecated.
  set maxTotalConnection on the underlying HttpConnectionManager

### setFollowRedirects

    public void setFollowRedirects(boolean followRedirects)

  Deprecated.
  set followRedirects.

  See Also:
    `_followRedirects`

### setAllowCompression

    public void setAllowCompression(boolean allowCompression)

  Deprecated.
  set allowCompression.

  See Also:
    `_allowCompression`

### setMaxRetries

    public void setMaxRetries(int maxRetries)

  Deprecated.
  set maximum number of retries to attempt in the event of transient errors.

  Parameters:
    `maxRetries` - No more than 1 recommended
  See Also:
    `_maxRetries`

### setRequestWriter

    public void setRequestWriter(RequestWriter requestWriter)

  Deprecated.

### add

    public UpdateResponse add(Iterator<SolrInputDocument> docIterator)
                       throws SolrServerException,
                              IOException

  Deprecated.
  Adds the documents supplied by the given iterator.

  Parameters:
    `docIterator` - the iterator which returns SolrInputDocument instances
  Returns:
    the response from the SolrServer
  Throws:
    `SolrServerException`
    `IOException`

### add

    public UpdateResponse add(Iterator<SolrInputDocument> docIterator,
                              int commitWithinMs)
                       throws SolrServerException,
                              IOException

  Deprecated.
  Adds the documents supplied by the given iterator, specifying max time before they become committed

  Parameters:
    `docIterator` - the iterator which returns SolrInputDocument instances
    `commitWithinMs` - the time in milliseconds before a commit automatically is triggered
  Returns:
    the response from the SolrServer
  Throws:
    `SolrServerException`
    `IOException`

### addBeans

    public UpdateResponse addBeans(Iterator<?> beanIterator)
                            throws SolrServerException,
                                   IOException

  Deprecated.
  Adds the beans supplied by the given iterator

  Parameters:
    `beanIterator` - the iterator which returns Beans
  Returns:
    the response from the SolrServer
  Throws:
    `SolrServerException`
    `IOException`

### addBeans

    public UpdateResponse addBeans(Iterator<?> beanIterator,
                                   int commitWithinMs)
                            throws SolrServerException,
                                   IOException

  Deprecated.
  Adds the beans supplied by the given iterator, specifying max time before they become committed

  Parameters:
    `commitWithinMs` - the time in milliseconds before a commit automatically is triggered
    `beanIterator` - the iterator which returns Beans
  Returns:
    the response from the SolrServer
  Throws:
    `SolrServerException`
    `IOException`