private final String relative(final String ref, final String aim) {
        if (aim.charAt(0) == '/') {
            return aim;
        }
        String value = ref;
        if (value.charAt(0) != '/') {
            value = '/' + value;
        }
        int index = value.lastIndexOf('/');
        value = index == -1 ? value : value.substring(0, index + 1);
        value = value.concat(aim);
        while ((index = value.indexOf("/./")) >= 0) {
            value = value.substring(0, index) + value.substring(index + 2);
        }
        while ((index = value.indexOf("/../")) >= 0) {
            if (index == 0) {
                value = value.substring(3);
            } else {
                value = value.substring(0, value.lastIndexOf('/', index - 1)) + value.substring(index + 3);
            }
        }
        while ((index = value.indexOf("/../")) >= 0) {
            if (index == 0) {
                value = value.substring(3);
            } else {
                value = value.substring(0, value.lastIndexOf('/', index - 1)) + value.substring(index + 3);
            }
        }
        return value;
    }