jooby/src/main/java/org/jooby/MediaType.java
/**
   * Get a {@link MediaType} for a file path.
   *
   * @param path A candidate file path: like <code>myfile.js</code> or <code>/js/myfile.js</code>.
   * @return A {@link MediaType} or empty optional for unknown file extensions.
   */
Get a  MediaType for a file path.
@param path A candidate file path: like myfile.js or /js/myfile.js.
@return A  MediaType or empty optional for unknown file extensions.
Get a MediaType for a file path . @param path A candidate file path : like myfile . js or / js / myfile . js . @return A MediaType or empty optional for unknown file extensions .
public static Optional<MediaType> byPath(final String path) {
    requireNonNull(path, "A path is required.");
    int idx = path.lastIndexOf('.');
    if (idx != -1) {
      String ext = path.substring(idx + 1);
      return byExtension(ext);
    }
    return Optional.empty();
  }
public static Optional < MediaType > byPath ( final String path ) { requireNonNull ( path , "A path is required." ) ; int idx = path . lastIndexOf ( '.' ) ; if ( idx != - 1 ) { String ext = path . substring ( idx + 1 ) ; return byExtension ( ext ) ; } return Optional . empty ( ) ; }
Get a {@link MediaType} for a file path.
Get a { @link MediaType } for a file path .