Refactored tools services endpoints system and fixed json formatter. #91

Merged
koleckia merged 12 commits from tools-services into master 2023-03-02 11:49:23 +01:00
Showing only changes of commit c7ce97dcdb - Show all commits

View File

@@ -2,29 +2,29 @@ package com.r11.tools.controller.internal.path;
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 (path.endsWith(PATH_SEPARATOR)) {
return path.substring(0, path.length() - 1);
if (resolvedPath.endsWith(PATH_SEPARATOR)) {
resolvedPath = resolvedPath.substring(0, resolvedPath.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;
}
}