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

Method appendUrlPath

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

Appends to the path of the URL @param uri the URI @param append the path to append @return the final URL version

(URI uri, String append)

Source from the content-addressed store, hash-verified

902 * @return the final URL version
903 */
904 protected static URI appendUrlPath(URI uri, String append) {
905 if (append == null || append.isEmpty()) {
906 return uri;
907 }
908 if (append.startsWith("/")) {
909 append = append.substring(1);
910 }
911 if (uri.getQuery() != null && !uri.getQuery().isEmpty()) {
912 append += "?" + uri.getQuery();
913 }
914 if (!uri.getPath().endsWith("/")) {
915 append = uri.getPath() + "/" + append;
916 }
917 return uri.resolve(append);
918 }
919
920 /**
921 * Guesses the type of file, based on file name suffix Returns "application/octet-stream" if no

Callers 3

testAppendUrlPathMethod · 0.95
doWebModeMethod · 0.95
postFileMethod · 0.95

Calls 5

getPathMethod · 0.65
resolveMethod · 0.65
isEmptyMethod · 0.45
substringMethod · 0.45
getQueryMethod · 0.45

Tested by 1

testAppendUrlPathMethod · 0.76