httpservices/src/main/java/ucar/httpservices/HTTPUtil.java
static public String
    canonjoin(String prefix, String suffix)
    {
        if(prefix == null) prefix = "";
        if(suffix == null) suffix = "";
        prefix = HTTPUtil.canonicalpath(prefix);
        suffix = HTTPUtil.canonicalpath(suffix);
        StringBuilder result = new StringBuilder();
        result.append(prefix);
        int prelen = prefix.length();
        if(prelen > 0 && result.charAt(prelen - 1) != '/') {
            result.append('/');
            prelen++;
        }
        if(suffix.length() > 0 && suffix.charAt(0) == '/')
            result.append(suffix.substring(1));
        else
            result.append(suffix);
        int len = result.length();
        if(len > 0 && result.charAt(len - 1) == '/') {
            result.deleteCharAt(len - 1);
            len--;
        }
        return result.toString();
    }
static public String
    canonjoin(String prefix, String suffix)
    {
        if(prefix == null) prefix = "";
        if(suffix == null) suffix = "";
        prefix = HTTPUtil.canonicalpath(prefix);
        suffix = HTTPUtil.canonicalpath(suffix);
        StringBuilder result = new StringBuilder();
        result.append(prefix);
        int prelen = prefix.length();
        if(prelen > 0 && result.charAt(prelen - 1) != '/') {
            result.append('/');
            prelen++;
        }
        if(suffix.length() > 0 && suffix.charAt(0) == '/')
            result.append(suffix.substring(1));
        else
            result.append(suffix);
        int len = result.length();
        if(len > 0 && result.charAt(len - 1) == '/') {
            result.deleteCharAt(len - 1);
            len--;
        }
        return result.toString();
    }
static public String canonjoin ( String prefix , String suffix ) { if ( prefix == null ) prefix = "" ; if ( suffix == null ) suffix = "" ; prefix = HTTPUtil . canonicalpath ( prefix ) ; suffix = HTTPUtil . canonicalpath ( suffix ) ; StringBuilder result = new StringBuilder ( ) ; result . append ( prefix ) ; int prelen = prefix . length ( ) ; if ( prelen > 0 && result . charAt ( prelen - 1 ) != ' ' ) { result . append ( ' ' ) ; prelen ++ ; } if ( suffix . length ( ) > 0 && suffix . charAt ( 0 ) == ' ' ) result . append ( suffix . substring ( 1 ) ) ; else result . append ( suffix ) ; int len = result . length ( ) ; if ( len > 0 && result . charAt ( len - 1 ) == ' ' ) { result . deleteCharAt ( len - 1 ) ; len -- ; } return result . toString ( ) ; }
Join two string together to form proper path
WITHOUT trailing slash

@param prefix
@param suffix
@return
Join two string together to form proper path WITHOUT trailing slash