예제 #1
0
 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;
 }
예제 #2
0
  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;
  }