tds/src/main/java/thredds/servlet/ServletUtil.java
public static String formFilename(String dirPath, String filePath) {
    if ((dirPath == null) || (filePath == null))
      return null;

    if (filePath.startsWith("/"))
      filePath = filePath.substring(1);

    return dirPath.endsWith("/") ? dirPath + filePath : dirPath + "/" + filePath;
  }
public static String formFilename(String dirPath, String filePath) {
    if ((dirPath == null) || (filePath == null))
      return null;

    if (filePath.startsWith("/"))
      filePath = filePath.substring(1);

    return dirPath.endsWith("/") ? dirPath + filePath : dirPath + "/" + filePath;
  }
Return the file path dealing with leading and trailing path
seperators (which must be a slash ("/")) for the given directory
and file paths.
<p/>
Note: Dealing with path strings is fragile.
ToDo: Switch from using path strings to java.io.Files.

@param dirPath  the directory path.
@param filePath the file path.
@return a full file path with the given directory and file paths.