Resolve the base and relative path. @param basePath a character array of the basePath @param relPath a character array of the relPath @return the resolved path @throws URIException no more higher path level to be resolved
(char[] basePath, char[] relPath)
| 2977 | * @throws URIException no more higher path level to be resolved |
| 2978 | */ |
| 2979 | protected char[] resolvePath(char[] basePath, char[] relPath) |
| 2980 | throws URIException { |
| 2981 | |
| 2982 | // REMINDME: paths are never null |
| 2983 | String base = (basePath == null) ? "" : new String(basePath); |
| 2984 | |
| 2985 | // _path could be empty |
| 2986 | if (relPath == null || relPath.length == 0) { |
| 2987 | return normalize(basePath); |
| 2988 | } else if (relPath[0] == '/') { |
| 2989 | return normalize(relPath); |
| 2990 | } else { |
| 2991 | int at = base.lastIndexOf('/'); |
| 2992 | if (at != -1) { |
| 2993 | basePath = base.substring(0, at + 1).toCharArray(); |
| 2994 | } |
| 2995 | StringBuilder buff = new StringBuilder(base.length() |
| 2996 | + relPath.length); |
| 2997 | buff.append((at != -1) ? base.substring(0, at + 1) : "/"); |
| 2998 | buff.append(relPath); |
| 2999 | return normalize(buff.toString().toCharArray()); |
| 3000 | } |
| 3001 | } |
| 3002 | |
| 3003 | |
| 3004 | /** |