From 6acfa2a4ffb1e5ac0973ac484e9cf8452b4b23d3 Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Wed, 27 Jan 2016 20:50:54 +0530 Subject: [PATCH] SOLR-8595: Use BinaryRequestWriter by default in HttpSolrClient and ConcurrentUpdateSolrClient --- solr/CHANGES.txt | 2 ++ .../org/apache/solr/client/solrj/impl/HttpSolrClient.java | 2 +- .../solr/client/solrj/impl/BasicHttpSolrClientTest.java | 6 ++++-- .../client/solrj/impl/ConcurrentUpdateSolrClientTest.java | 2 -- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 6572a7311a1..462ed339910 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -570,6 +570,8 @@ Other Changes * SOLR-8565: add & use CommonParams.(ROWS|START)_DEFAULT constants (Christine Poerschke) +* SOLR-8595: Use BinaryRequestWriter by default in HttpSolrClient and ConcurrentUpdateSolrClient. (shalin) + ================== 5.4.1 ================== Bug Fixes diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java index 1f526dc286c..fccac9d1c63 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java @@ -140,7 +140,7 @@ public class HttpSolrClient extends SolrClient { * * @see org.apache.solr.client.solrj.request.RequestWriter */ - protected volatile RequestWriter requestWriter = new RequestWriter(); + protected volatile RequestWriter requestWriter = new BinaryRequestWriter(); private final HttpClient httpClient; diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java index fd646296c06..fad031cebf5 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java @@ -62,6 +62,7 @@ import org.apache.solr.client.solrj.SolrRequest.METHOD; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.embedded.JettyConfig; import org.apache.solr.client.solrj.request.QueryRequest; +import org.apache.solr.client.solrj.request.RequestWriter; import org.apache.solr.client.solrj.request.UpdateRequest; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrException; @@ -452,13 +453,14 @@ public class BasicHttpSolrClientTest extends SolrJettyTestBase { assertEquals(1, DebugServlet.parameters.get(CommonParams.VERSION).length); assertEquals(client.getParser().getVersion(), DebugServlet.parameters.get(CommonParams.VERSION)[0]); //content type - assertEquals("application/xml; charset=UTF-8", DebugServlet.headers.get("Content-Type")); + assertEquals("application/javabin", DebugServlet.headers.get("Content-Type")); //parameter encoding assertEquals(1, DebugServlet.parameters.get("a").length); assertEquals("\u1234", DebugServlet.parameters.get("a")[0]); - //XML response + //XML response and writer client.setParser(new XMLResponseParser()); + client.setRequestWriter(new RequestWriter()); try { client.request(req); } catch (ParseException ignored) {} diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientTest.java index 64c1788d836..bee0361556b 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientTest.java @@ -160,8 +160,6 @@ public class ConcurrentUpdateSolrClientTest extends SolrJettyTestBase { } }; - concurrentClient.setParser(new BinaryResponseParser()); - concurrentClient.setRequestWriter(new BinaryRequestWriter()); concurrentClient.setPollQueueTime(0); // ensure it doesn't block where there's nothing to do yet