jooby/src/main/java/org/jooby/MediaType.java
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.

@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.