private static String removeRoot(String fileName) { if (StringUtil.isBlankOrNull(fileName)) { return fileName; } fileName = fileName.trim(); if (fileName.startsWith("\\") || fileName.startsWith("/")) { return fileName.substring(1); } return fileName; }
public static String reciveModelPath(String fileUrl, String configurationFile) { if (StringUtil.isBlankOrNull(fileUrl)) { return fileUrl; } if (configurationFile.startsWith(ResourceService.PLUGIN_FILE_PREFIX)) { // if configuration is stored inside plug-in, all resources should // be taken from plug-in jar root return ResourceService.PLUGIN_FILE_PREFIX + "/" + removeRoot(fileUrl); } String directory = ResourceUtil.getUrlDrectory(configurationFile); if (StringUtil.isBlankOrNull(directory)) { return fileUrl; } fileUrl = removeRoot(fileUrl); return directory + "/" + fileUrl; }