manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1841588 - in /manifoldcf/branches/release-2.11-branch: ./ connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/ModifiedHttpSolrClient.java
Date Fri, 21 Sep 2018 13:39:06 GMT
Author: kwright
Date: Fri Sep 21 13:39:06 2018
New Revision: 1841588

URL: http://svn.apache.org/viewvc?rev=1841588&view=rev
Log:
Pull up partial fix for CONNECTORS-1533 from trunk.

Modified:
    manifoldcf/branches/release-2.11-branch/   (props changed)
    manifoldcf/branches/release-2.11-branch/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/ModifiedHttpSolrClient.java

Propchange: manifoldcf/branches/release-2.11-branch/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep 21 13:39:06 2018
@@ -152,4 +152,4 @@
 /manifoldcf/branches/CONNECTORS-981:1605049-1605773
 /manifoldcf/branches/CONNECTORS-989:1611600-1612101
 /manifoldcf/branches/CONNECTORS-990:1610284-1610707
-/manifoldcf/trunk:1841397
+/manifoldcf/trunk:1841397,1841587

Modified: manifoldcf/branches/release-2.11-branch/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/ModifiedHttpSolrClient.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/release-2.11-branch/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/ModifiedHttpSolrClient.java?rev=1841588&r1=1841587&r2=1841588&view=diff
==============================================================================
--- manifoldcf/branches/release-2.11-branch/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/ModifiedHttpSolrClient.java
(original)
+++ manifoldcf/branches/release-2.11-branch/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/ModifiedHttpSolrClient.java
Fri Sep 21 13:39:06 2018
@@ -18,6 +18,7 @@ package org.apache.manifoldcf.agents.out
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
 import java.net.ConnectException;
 import java.net.SocketTimeoutException;
 import java.nio.charset.Charset;
@@ -53,6 +54,7 @@ import org.apache.http.message.BasicHead
 import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.util.EntityUtils;
 import org.apache.http.entity.ContentType;
+import org.apache.http.entity.BasicHttpEntity;
 import org.apache.manifoldcf.core.util.URLDecoder;
 import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.client.solrj.ResponseParser;
@@ -156,7 +158,26 @@ public class ModifiedHttpSolrClient exte
           || (streams != null && streams.size() > 1)) && !hasNullStreamName;
 
       LinkedList<NameValuePair> postOrPutParams = new LinkedList<>();
-      if (streams == null || isMultipart) {
+      if(contentWriter != null) {
+        String fullQueryUrl = url + toQueryString(wparams, false);
+        HttpEntityEnclosingRequestBase postOrPut = SolrRequest.METHOD.POST == request.getMethod()
?
+            new HttpPost(fullQueryUrl) : new HttpPut(fullQueryUrl);
+        postOrPut.addHeader("Content-Type",
+            contentWriter.getContentType());
+        postOrPut.setEntity(new BasicHttpEntity(){
+          @Override
+          public boolean isStreaming() {
+            return true;
+          }
+
+          @Override
+          public void writeTo(OutputStream outstream) throws IOException {
+            contentWriter.write(outstream);
+          }
+        });
+        return postOrPut;
+
+      } else if (streams == null || isMultipart) {
         // send server list and request list as query string params
         ModifiableSolrParams queryParams = calculateQueryParams(getQueryParams(), wparams);
         queryParams.add(calculateQueryParams(request.getQueryParams(), wparams));



Mime
View raw message