You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ry...@apache.org on 2013/04/17 01:32:28 UTC

svn commit: r1468682 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/solrj/ solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java

Author: ryan
Date: Tue Apr 16 23:32:27 2013
New Revision: 1468682

URL: http://svn.apache.org/r1468682
Log:
Merged revision(s) 1468680 from lucene/dev/trunk:
SOLR-4358: reverting sending the name
........

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java

Modified: lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java?rev=1468682&r1=1468681&r2=1468682&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java (original)
+++ lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java Tue Apr 16 23:32:27 2013
@@ -70,8 +70,6 @@ public class HttpSolrServer extends Solr
   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 Solr
     if (invariantParams != null) {
       wparams.add(invariantParams);
     }
+    params = wparams;
     
     int tries = maxRetries + 1;
     try {
@@ -221,7 +220,7 @@ public class HttpSolrServer extends Solr
             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 Solr
               }
 
               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 Solr
                            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 Solr
             }
             // It is has one stream, it is the post body, put the params in the URL
             else {
+              String pstr = ClientUtils.toQueryString(params, false);
+              HttpPost post = new HttpPost(url + pstr);
+
               // Single stream as body
               // Using a loop just to get the first one
               final ContentStream[] contentStream = new ContentStream[1];
@@ -295,12 +291,6 @@ public class HttpSolrServer extends Solr
                 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 Solr
     }
     
     // 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 Solr
           "Client was created outside of HttpSolrServer");
     }
   }
-
+  
   public boolean isUseMultiPartPost() {
     return useMultiPartPost;
   }
@@ -641,4 +632,4 @@ public class HttpSolrServer extends Solr
   public void setUseMultiPartPost(boolean useMultiPartPost) {
     this.useMultiPartPost = useMultiPartPost;
   }
-}
+}
\ No newline at end of file