Apache Solr open-source search software
SOLR-4358: reverting sending the name
Ryan McKinley5fc7f74c8c6e
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.javaindex 31571db0d51..f4063a0db13 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java@@ -70,8 +70,6 @@ public class HttpSolrServer extends SolrServer {private static final String UTF_8 = "UTF-8";private static final String DEFAULT_PATH = "/select";private static final long serialVersionUID = -946812319974801896L;- private static final String RESOURCE_NAME = "resource.name";-/*** User-Agent String.*/@@ -208,6 +206,7 @@ public class HttpSolrServer extends SolrServer {if (invariantParams != null) {wparams.add(invariantParams);}+ params = wparams;int tries = maxRetries + 1;try {@@ -221,7 +220,7 @@ public class HttpSolrServer extends SolrServer {if( streams != null ) {throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "GET can't send streams!" );}- method = new HttpGet( baseUrl + path + ClientUtils.toQueryString( wparams, false ) );+ method = new HttpGet( baseUrl + path + ClientUtils.toQueryString( params, false ) );}else if( SolrRequest.METHOD.POST == request.getMethod() ) {@@ -238,10 +237,10 @@ public class HttpSolrServer extends SolrServer {}List<FormBodyPart> parts = new LinkedList<FormBodyPart>();- Iterator<String> iter = wparams.getParameterNamesIterator();+ Iterator<String> iter = params.getParameterNamesIterator();while (iter.hasNext()) {String p = iter.next();- String[] vals = wparams.getParams(p);+ String[] vals = params.getParams(p);if (vals != null) {for (String v : vals) {if (this.useMultiPartPost || isMultipart) {@@ -265,12 +264,6 @@ public class HttpSolrServer extends SolrServer {contentType,content.getName())));}- } else {- for (ContentStream content : streams) {- if (content.getName() != null) {- postParams.add(new BasicNameValuePair(RESOURCE_NAME, content.getName()));- }- }}if (parts.size() > 0) {@@ -288,6 +281,9 @@ public class HttpSolrServer extends SolrServer {}// It is has one stream, it is the post body, put the params in the URLelse {+ String pstr = ClientUtils.toQueryString(params, false);+ HttpPost post = new HttpPost(url + pstr);+// Single stream as body// Using a loop just to get the first onefinal ContentStream[] contentStream = new ContentStream[1];@@ -295,12 +291,6 @@ public class HttpSolrServer extends SolrServer {contentStream[0] = content;break;}- if (contentStream[0] != null && contentStream[0].getName() != null) {- wparams.set(RESOURCE_NAME, contentStream[0].getName());- }- String pstr = ClientUtils.toQueryString(wparams, false);- HttpPost post = new HttpPost(url + pstr);-if (contentStream[0] instanceof RequestWriter.LazyContentStream) {post.setEntity(new InputStreamEntity(contentStream[0].getStream(), -1) {@Override@@ -350,7 +340,8 @@ public class HttpSolrServer extends SolrServer {}// XXX client already has this set, is this needed?- method.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, followRedirects);+ method.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS,+ followRedirects);method.addHeader("User-Agent", AGENT);InputStream respBody = null;@@ -630,7 +621,7 @@ public class HttpSolrServer extends SolrServer {"Client was created outside of HttpSolrServer");}}-+public boolean isUseMultiPartPost() {return useMultiPartPost;}@@ -641,4 +632,4 @@ public class HttpSolrServer extends SolrServer {public void setUseMultiPartPost(boolean useMultiPartPost) {this.useMultiPartPost = useMultiPartPost;}-}+}\ No newline at end of file