MCPcopy Create free account
hub / github.com/apache/solr / appendParam

Method appendParam

solr/core/src/java/org/apache/solr/cli/PostTool.java:799–819  ·  view source on GitHub ↗

Appends a URL query parameter to a URL @param url the original URL @param param the parameter(s) to append, separated by "&" @return the string version of the resulting URL

(String url, String param)

Source from the content-addressed store, hash-verified

797 * @return the string version of the resulting URL
798 */
799 public static String appendParam(String url, String param) {
800 String[] pa = param.split("&");
801 StringBuilder urlBuilder = new StringBuilder(url);
802 for (String p : pa) {
803 if (p.trim().isEmpty()) {
804 continue;
805 }
806 String[] kv = p.split("=");
807 if (kv.length == 2) {
808 urlBuilder
809 .append(urlBuilder.toString().contains("?") ? "&" : "?")
810 .append(kv[0])
811 .append("=")
812 .append(kv[1]);
813 } else {
814 warn("Skipping param " + p + " which is not on form key=value");
815 }
816 }
817 url = urlBuilder.toString();
818 return url;
819 }
820
821 /** Opens the file and posts its contents to the solrUrl, writes to response to output. */
822 public void postFile(Path file, OutputStream output, String type)

Callers 5

testAppendParamMethod · 0.95
webCrawlMethod · 0.95
postFileMethod · 0.95
postDataMethod · 0.95
getLinksFromWebPageMethod · 0.80

Calls 7

warnMethod · 0.95
appendMethod · 0.65
toStringMethod · 0.65
splitMethod · 0.45
isEmptyMethod · 0.45
trimMethod · 0.45
containsMethod · 0.45

Tested by 1

testAppendParamMethod · 0.76