tds/src/main/java/thredds/server/ncss/controller/AbstractNcssController.java
public static String getDatasetPath(String path) {
    if (path.startsWith(StandardService.netcdfSubsetGrid.getBase())) {               // strip off /ncss/grid/
      path = path.substring(StandardService.netcdfSubsetGrid.getBase().length());

    } else if (path.startsWith(StandardService.netcdfSubsetPoint.getBase())) {       // strip off /ncss/point/
      path = path.substring(StandardService.netcdfSubsetPoint.getBase().length());
    }

    // strip off endings
    for (String ending : endings) {
      if (path.endsWith(ending)) {
        int len = path.length() - ending.length();
        path = path.substring(0, len);
        break;
      }
    }

    return path;
  }
public static String getDatasetPath(String path) {
    if (path.startsWith(StandardService.netcdfSubsetGrid.getBase())) {               // strip off /ncss/grid/
      path = path.substring(StandardService.netcdfSubsetGrid.getBase().length());

    } else if (path.startsWith(StandardService.netcdfSubsetPoint.getBase())) {       // strip off /ncss/point/
      path = path.substring(StandardService.netcdfSubsetPoint.getBase().length());
    }

    // strip off endings
    for (String ending : endings) {
      if (path.endsWith(ending)) {
        int len = path.length() - ending.length();
        path = path.substring(0, len);
        break;
      }
    }

    return path;
  }
unit testing