Refactored tools services endpoints system and fixed json formatter. #91
@@ -2,29 +2,29 @@ package com.r11.tools.controller.internal.path;
|
|||||||
|
|
||||||
public final class PathBuilder {
|
public final class PathBuilder {
|
||||||
|
|
||||||
private static final String PATH_SEPARATOR = "/";
|
private static final String PATH_SEPARATOR = "/";
|
||||||
|
|
||||||
private PathBuilder() {
|
private PathBuilder() {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String resolvePathOf(String globalPath, String scopedPath) {
|
|
||||||
String resolvedPath =
|
|
||||||
PathBuilder.removeTrailingPathSeparator(globalPath) +
|
|
||||||
PathBuilder.removeTrailingPathSeparator(scopedPath);
|
|
||||||
|
|
||||||
if (resolvedPath.endsWith(PATH_SEPARATOR)) {
|
|
||||||
resolvedPath = resolvedPath.substring(0, resolvedPath.length() - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PATH_SEPARATOR + resolvedPath;
|
public static String resolvePathOf(String globalPath, String scopedPath) {
|
||||||
}
|
String resolvedPath =
|
||||||
|
PathBuilder.removeTrailingPathSeparator(globalPath) +
|
||||||
|
PathBuilder.removeTrailingPathSeparator(scopedPath);
|
||||||
|
|
||||||
private static String removeTrailingPathSeparator(String path) {
|
if (resolvedPath.endsWith(PATH_SEPARATOR)) {
|
||||||
if (path.endsWith(PATH_SEPARATOR)) {
|
resolvedPath = resolvedPath.substring(0, resolvedPath.length() - 1);
|
||||||
return path.substring(0, path.length() - 1);
|
}
|
||||||
|
|
||||||
|
return PATH_SEPARATOR + resolvedPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
private static String removeTrailingPathSeparator(String path) {
|
||||||
}
|
if (path.endsWith(PATH_SEPARATOR)) {
|
||||||
|
return path.substring(0, path.length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user