commons/core/src/main/java/org/ldp4j/commons/net/URIUtils.java
private static String merge(String path, String relativePath, boolean hasAuthority) {
		String parent=path;
		if(hasAuthority && parent.isEmpty()) {
			parent=SLASH;
		}
		return parent.substring(0,parent.lastIndexOf('/')+1).concat(relativePath);
	}
private static String merge(String path, String relativePath, boolean hasAuthority) {
		String parent=path;
		if(hasAuthority && parent.isEmpty()) {
			parent=SLASH;
		}
		return parent.substring(0,parent.lastIndexOf('/')+1).concat(relativePath);
	}
private static String merge ( String path , String relativePath , boolean hasAuthority ) { String parent = path ; if ( hasAuthority && parent . isEmpty ( ) ) { parent = SLASH ; } return parent . substring ( 0 , parent . lastIndexOf ( ' ' ) + 1 ) . concat ( relativePath ) ; }
5.2.3.  Merge Paths

The pseudocode above refers to a "merge" routine for merging a
relative-path reference with the path of the base URI.  This is
accomplished as follows:

o  If the base URI has a defined authority component and an empty
path, then return a string consisting of "/" concatenated with the
reference's path; otherwise,
o  return a string consisting of the reference's path component
appended to all but the last segment of the base URI's path (i.e.,
excluding any characters after the right-most "/" in the base URI
path, or excluding the entire base URI path if it does not contain
any "/" characters).

@param hasAuthority
5 . 2 . 3 . Merge Paths