Automatically determines extension from path.

@see  #getLastModified(javax.servlet.ServletContext, java.lang.String, java.lang.String)
198275
public static long getLastModified(ServletContext servletContext, HttpServletRequest request, String path) {
		return getLastModified(
			servletContext,
			request,
			path,
			FileUtils.getExtension(path)
		);
	}
311666
public static String getExtension(final String filename) {
        Objects.requireNonNull(filename, "filename cannot be null");
        int lastDotIdx = filename.lastIndexOf(".");
        return lastDotIdx >= 0 ? filename.substring(lastDotIdx) : "";
    }
788499
@Override
    public String getPathTranslated() {
        final String info = getPathInfo();
        return (null == info) ? null : getServletContext().getRealPath(info);
    }
241073
public String getExtension(String url) {
		int dotIndex = url.lastIndexOf('.');
		String extension = null;
		if (dotIndex > 0) {
			extension = url.substring(dotIndex + 1);
		}
		return extension;
	}
521021
public long getLastModified() {
        if(matchedEntry != null){
            return matchedEntry.getLastModified();
        } else if (matchedZipFile != null){
            return matchedZipFile.getLastModified();
        } else if (matchedFile != null){
            return matchedFile.lastModified();
        } else {
            return 0;
        }
    }
589063
@Override
   public long getLastModified()
   {
      try
      {
         if (!connected)
         {
            connect();
         }

         return nodeRepresentation.getLastModified();
      }
      catch (IOException e)
      {
         if (LOG.isTraceEnabled())
         {
            LOG.trace("An exception occurred: " + e.getMessage());
         }
      }
      catch (RepositoryException e)
      {
         if (LOG.isTraceEnabled())
         {
            LOG.trace("An exception occurred: " + e.getMessage());
         }
      }
      return 0;
   }
1323608
String getPath() {
    StringBuilder result = new StringBuilder();

    boolean first = true;
    for (String part : getSegments()) {
      if (first) {
        result.append(part);
        first = false;
      } else {
        result.append("/").append(part);
      }
    }

    return result.toString();
  }
151878
public long getLastModified() {
        final SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new VirtualFilePermission(getPathName(), "read"));
        }
        final VFS.Mount mount = VFS.getMount(this);
        if (sm != null) {
            return AccessController.doPrivileged(
                    (PrivilegedAction<Long>) () -> mount.getFileSystem().getLastModified(mount.getMountPoint(), this)
            );
        }
        return mount.getFileSystem().getLastModified(mount.getMountPoint(), this);
    }
249150
protected long getLastModified(IAggregator aggregator, ModuleList modules) {
		long result = 0L;
		for (ModuleList.ModuleListEntry entry : modules) {
			IResource resource = entry.getModule().getResource(aggregator);
			long lastMod = resource.lastModified();
			result = Math.max(result, lastMod);
		}
		return result;
	}
1090845
private String getPathExtension(HttpServletRequest request) {
		String extension = UriUtils.extractFileExtension(request.getRequestURI());		
		return extension != null ? "." + extension : "";
	}
755772
def determine_path():
    """"""
    root = __file__
    if os.path.islink(root):
        root = os.path.realpath(root)
    return os.path.dirname(os.path.abspath(root))
1342136
private Set<String> findExclusionPaths(ServletContext servletContext) {
        Set<String> exclusions = new TreeSet<String>();
        
        // Let other handlers deal with folders that do not reside in the WEB-INF or META-INF
        Set<String> resourcePaths = servletContext.getResourcePaths("/");
        
        // This most certainly should not be null!
        // It means that the server cannot read files at all
        if (resourcePaths == null) throw new InitException("ServletContext cannot read files. Reason is unknown");
        
        resourcePaths.removeIf( path -> path.contains("-INF") || path.contains("-inf"));
    
        // We still need to also remove the views folder from being processed by other handlers
        resourcePaths.removeIf( path -> path.contains(TemplateEngine.TEMPLATES_FOLDER));
        
        // Add the remaining paths to exclusions
        for (String path : resourcePaths) {
            // add leading slash
            if (path.charAt(0) != '/')
                path = '/' + path;
            
            // remove the last slash
            if (path.charAt(path.length()-1) == '/')
                path = path.substring(0, path.length()-1);
            exclusions.add(path);
        }
        
        return exclusions;
    }
116268
private String getShortPath(String rootPath) {
        File file = new File(rootPath);
        String lastPathAfterSeparator = null;
        String shortPath = getWindowsShortPath(file.getAbsolutePath());
        if (StringUtils.isNotEmpty(shortPath)) {
            return getWindowsShortPath(file.getAbsolutePath());
        } else {
            while (StringUtils.isEmpty(getWindowsShortPath(file.getAbsolutePath()))) {
                String filePath = file.getAbsolutePath();
                if (StringUtils.isNotEmpty(lastPathAfterSeparator)) {
                    lastPathAfterSeparator = file.getAbsolutePath().substring(filePath.lastIndexOf(WINDOWS_SEPARATOR), filePath.length()) + lastPathAfterSeparator;
                } else {
                    lastPathAfterSeparator = file.getAbsolutePath().substring(filePath.lastIndexOf(WINDOWS_SEPARATOR), filePath.length());
                }
                file = file.getParentFile();
            }
            return getWindowsShortPath(file.getAbsolutePath()) + lastPathAfterSeparator;
        }
    }
402750
private void applyPathsDocumentExtension(Context context) {
        extensionRegistry.getPathsDocumentExtensions().forEach(extension -> extension.apply(context));
    }
1291880
@Override
    protected File getFileForLastModifiedCheck() throws IOException {
        URL url = getURL();
        if (ResourceUtils.isJarURL(url)) {
            URL actualUrl = ResourceUtils.extractArchiveURL(url);
            return ResourceUtils.getFile(actualUrl, "Jar URL");
        } else {
            return getFile();
        }
    }
902769
public long getLastModified(String path)
  {
    try {
      // this entry time can cause problems ...
      ZipEntry entry = getZipEntry(path);

      return entry != null ? entry.getTime() : -1;
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
    }

    return  -1;
  }
14284
function getPathFromContext (ctx) {
  let path = ctx.path.join('.')

  // check if we specifically set type
  const lastElement = ctx.path[ctx.path.length - 1]
  if (lastElement) {
    const lev = lastElement.toLowerCase()
    if (lev === 'type') {
      path = ctx.path.slice(0, ctx.path.length - 1).join('.')
    }
  }

  // check if in array
  const reg = new RegExp('^\\d+$')
  const lastPath = path.substring(path.lastIndexOf('.') + 1)
  if (lastPath && reg.test(lastPath)) {
    path = path.substring(0, path.lastIndexOf('.'))
  }

  return path
}