gerlowskija commented on code in PR #2455:
URL: https://github.com/apache/solr/pull/2455#discussion_r1624884632


##########
solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java:
##########
@@ -56,6 +63,51 @@ public static Collection<ContentStream> toContentStreams(
     return streams;
   }
 
+  /**
+   * Create the full URL for a SolrRequest (excepting query parameters) as a 
String
+   *
+   * @param solrRequest the {@link SolrRequest} to build the URL for
+   * @param requestWriter a {@link RequestWriter} from the {@link SolrClient} 
that will be sending
+   *     the request
+   * @param serverRootUrl the root URL of the Solr server being targeted. May 
by overridden {@link
+   *     SolrRequest#getBasePath()}, if present.
+   * @param collection the collection to send the request to. May be null if 
no collection is
+   *     needed.
+   * @throws MalformedURLException if {@code serverRootUrl} or {@link 
SolrRequest#getBasePath()}
+   *     contain a malformed URL string
+   */
+  public static String buildRequestUrl(
+      SolrRequest<?> solrRequest,
+      RequestWriter requestWriter,
+      String serverRootUrl,
+      String collection)
+      throws MalformedURLException {
+    String basePath = solrRequest.getBasePath() == null ? serverRootUrl : 
solrRequest.getBasePath();
+
+    if (solrRequest instanceof V2Request) {
+      if (System.getProperty("solr.v2RealPath") == null) {
+        basePath = changeV2RequestEndpoint(basePath);
+      } else {
+        basePath = serverRootUrl + "/____v2";

Review Comment:
   Agreed.
   
   One of my goals for this PR is to get all the logic into one place so that 
we can more easily identify the warts that don't make sense anymore, and look 
at removing them.  For this one in particular the sysprop seems to be primarily 
for our tests, and isn't documented anywhere..maybe it could be removed 
altogether?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to