For basic authentication in solr 3.5, I use the following code,
String url = "http://192.168.192.11:8080/solr/FormResponses"; CommonsHttpSolrServer server = new CommonsHttpSolrServer( url ); String username = "user"; String password = "user123"; Credentials defaultcreds = new UsernamePasswordCredentials(username, password); server.getHttpClient().getState().setCredentials(AuthScope.ANY, defaultcreds); server.getHttpClient().getParams().setAuthenticationPreemptive(true);
In CommonsHttpSolrServer 4.0 CommonsHttpSolrServer not available, so I want to replace it with HttpSolrServer . Can someone help me fix this?
source share