lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r781977 - in /lucene/solr/trunk: CHANGES.txt src/java/org/apache/solr/handler/SnapPuller.java
Date Fri, 05 Jun 2009 10:36:43 GMT
Author: shalin
Date: Fri Jun  5 10:36:43 2009
New Revision: 781977

URL: http://svn.apache.org/viewvc?rev=781977&view=rev
Log:
SOLR-1189 -- Support providing username and password for basic HTTP authentication in Java
replication

Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/src/java/org/apache/solr/handler/SnapPuller.java

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=781977&r1=781976&r2=781977&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Fri Jun  5 10:36:43 2009
@@ -232,6 +232,9 @@
 
 58. SOLR-1204: Enhance SpellingQueryConverter to handle UTF-8 instead of ASCII only (Michael
Ludwig via shalin)
 
+59. SOLR-1189: Support providing username and password for basic HTTP authentication in Java
replication
+    (Matthew Gregg, shalin)
+
 Optimizations
 ----------------------
  1. SOLR-374: Use IndexReader.reopen to save resources by re-using parts of the

Modified: lucene/solr/trunk/src/java/org/apache/solr/handler/SnapPuller.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/SnapPuller.java?rev=781977&r1=781976&r2=781977&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/SnapPuller.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/SnapPuller.java Fri Jun  5 10:36:43
2009
@@ -17,6 +17,7 @@
 package org.apache.solr.handler;
 
 import org.apache.commons.httpclient.*;
+import org.apache.commons.httpclient.auth.AuthScope;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.io.IOUtils;
 import org.apache.lucene.index.IndexCommit;
@@ -103,6 +104,8 @@
   private static HttpClient client;
   // HttpClient for this instance if connectionTimeout or readTimeout has been specified
   private final HttpClient myHttpClient;
+  private static final String HTTP_BASIC_AUTH_USER = "httpBasicAuthUser";
+  private static final String HTTP_BASIC_AUTH_PASSWORD = "httpBasicAuthPassword";
 
   private static synchronized HttpClient createHttpClient(String connTimeout, String readTimeout)
{
     if (connTimeout == null && readTimeout == null && client != null)  return
client;
@@ -132,7 +135,13 @@
     useExternal = EXTERNAL.equals(compress);
     String connTimeout = (String) initArgs.get(HTTP_CONN_TIMEOUT);
     String readTimeout = (String) initArgs.get(HTTP_READ_TIMEOUT);
+    String httpBasicAuthUser = (String) initArgs.get(HTTP_BASIC_AUTH_USER);
+    String httpBasicAuthPassword = (String) initArgs.get(HTTP_BASIC_AUTH_PASSWORD);
     myHttpClient = createHttpClient(connTimeout, readTimeout);
+    if (httpBasicAuthUser != null && httpBasicAuthPassword != null) {
+      myHttpClient.getState().setCredentials(AuthScope.ANY,
+              new UsernamePasswordCredentials(httpBasicAuthUser, httpBasicAuthPassword));
+    }
     if (pollInterval != null && pollInterval > 0) {
       startExecutorService();
     } else {



Mime
View raw message