dsmiley commented on code in PR #3829:
URL: https://github.com/apache/solr/pull/3829#discussion_r3229430958
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java:
##########
@@ -104,7 +97,24 @@ protected HttpSolrClientBase(String serverBaseUrl,
HttpSolrClientBuilderBase<?,
}
}
- public abstract HttpSolrClientBuilderBase<?, ?> builder();
+ private static String extractBaseUrl(String serverBaseUrl) {
+ if (serverBaseUrl == null) {
+ return null;
+ }
+ if (!serverBaseUrl.equals("/") && serverBaseUrl.endsWith("/")) {
+ serverBaseUrl = serverBaseUrl.substring(0, serverBaseUrl.length() - 1);
+ }
+
+ if (serverBaseUrl.startsWith("//")) {
+ serverBaseUrl = serverBaseUrl.substring(1);
+ }
+ return serverBaseUrl;
+ }
+
+ /** Typically looks like {@code http://localhost:8983/solr} (no core or
collection) */
+ public String getBaseURL() {
Review Comment:
I kinda wish we use URL as a type instead of a String both for added type
safety and also likely avoids extra parsing. Jetty & JDK HttpClients natively
works with a URI -- passing a String results in URI parsing _anyway_.
I suppose we could add getBaseUri at some point.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]