tds/src/main/java/thredds/core/DatasetManager.java
public CoverageCollection openCoverageDataset(HttpServletRequest req, HttpServletResponse res, String reqPath) throws IOException {
    if (reqPath == null)
      return null;

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

    // see if its under resource control
    if (!resourceControlOk(req, res, reqPath))
      return null;

    DataRootManager.DataRootMatch match = dataRootManager.findDataRootMatch(reqPath);

    // first look for a feature collection
    if ((match != null) && (match.dataRoot.getFeatureCollection() != null)) {
      FeatureCollectionRef featCollection = match.dataRoot.getFeatureCollection();
      if (log.isDebugEnabled()) log.debug("  -- DatasetHandler found FeatureCollection= " + featCollection);

      InvDatasetFeatureCollection fc = featureCollectionCache.get(featCollection);
      CoverageCollection gds = fc.getGridCoverage(match.remaining);
      if (gds == null) throw new FileNotFoundException(reqPath);
      return gds;
    }

    // otherwise assume its a local file

    // try to open as a FeatureDatasetCoverage. This allows GRIB to be handle specially
    String location = getLocationFromRequestPath(reqPath);
    if (location != null) {
      Optional<FeatureDatasetCoverage> opt = CoverageDatasetFactory.openCoverageDataset(location);
      if (!opt.isPresent())
        throw new FileNotFoundException("Not a Grid Dataset " + reqPath + " err=" + opt.getErrorMessage());

      if (log.isDebugEnabled()) log.debug("  -- DatasetHandler found FeatureCollection from file= " + location);
      return opt.get().getSingleCoverageCollection(); // LOOK doesnt have to be single, then what is the URL?

    }

    // if ncml, must handle special, otherwise we're out of options for opening
    // a coverage collection.

    String ncml = datasetTracker.findNcml(reqPath);
    if (ncml != null) {
      Optional<FeatureDatasetCoverage> opt = CoverageDatasetFactory.openNcmlString(ncml);
      if (!opt.isPresent())
        throw new FileNotFoundException("NcML is not a Grid Dataset " + reqPath + " err=" + opt.getErrorMessage());

      if (log.isDebugEnabled()) log.debug("  -- DatasetHandler found FeatureCollection from NcML");
      return opt.get().getSingleCoverageCollection();
    }

    return null;
  }
public CoverageCollection openCoverageDataset(HttpServletRequest req, HttpServletResponse res, String reqPath) throws IOException {
    if (reqPath == null)
      return null;

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

    // see if its under resource control
    if (!resourceControlOk(req, res, reqPath))
      return null;

    DataRootManager.DataRootMatch match = dataRootManager.findDataRootMatch(reqPath);

    // first look for a feature collection
    if ((match != null) && (match.dataRoot.getFeatureCollection() != null)) {
      FeatureCollectionRef featCollection = match.dataRoot.getFeatureCollection();
      if (log.isDebugEnabled()) log.debug("  -- DatasetHandler found FeatureCollection= " + featCollection);

      InvDatasetFeatureCollection fc = featureCollectionCache.get(featCollection);
      CoverageCollection gds = fc.getGridCoverage(match.remaining);
      if (gds == null) throw new FileNotFoundException(reqPath);
      return gds;
    }

    // otherwise assume its a local file

    // try to open as a FeatureDatasetCoverage. This allows GRIB to be handle specially
    String location = getLocationFromRequestPath(reqPath);
    if (location != null) {
      Optional<FeatureDatasetCoverage> opt = CoverageDatasetFactory.openCoverageDataset(location);
      if (!opt.isPresent())
        throw new FileNotFoundException("Not a Grid Dataset " + reqPath + " err=" + opt.getErrorMessage());

      if (log.isDebugEnabled()) log.debug("  -- DatasetHandler found FeatureCollection from file= " + location);
      return opt.get().getSingleCoverageCollection(); // LOOK doesnt have to be single, then what is the URL?

    }

    // if ncml, must handle special, otherwise we're out of options for opening
    // a coverage collection.

    String ncml = datasetTracker.findNcml(reqPath);
    if (ncml != null) {
      Optional<FeatureDatasetCoverage> opt = CoverageDatasetFactory.openNcmlString(ncml);
      if (!opt.isPresent())
        throw new FileNotFoundException("NcML is not a Grid Dataset " + reqPath + " err=" + opt.getErrorMessage());

      if (log.isDebugEnabled()) log.debug("  -- DatasetHandler found FeatureCollection from NcML");
      return opt.get().getSingleCoverageCollection();
    }

    return null;
  }
return null means request has been handled, and calling routine should exit without further processing