private static String guessContentType(String url){
  url=url.toLowerCase();
  if (url.endsWith(".webm")) {
    return "video/webm";
  }
 else   if (url.endsWith(".mp4")) {
    return "video/mp4";
  }
 else   if (url.matches(".*\\.jpe?g")) {
    return "image/jpeg";
  }
 else   if (url.endsWith(".png")) {
    return "image/png";
  }
 else   if (url.endsWith(".gif")) {
    return "image/gif";
  }
 else {
    return "application/octet-stream";
  }
}

private static String guessContentType ( String url ) { url = url . toLowerCase ( ) ; if ( url . endsWith ( ".webm" ) ) { return "video/webm" ; } else if ( url . endsWith ( ".mp4" ) ) { return "video/mp4" ; } else if ( url . matches ( ".*\\.jpe?g" ) ) { return "image/jpeg" ; } else if ( url . endsWith ( ".png" ) ) { return "image/png" ; } else if ( url . endsWith ( ".gif" ) ) { return "image/gif" ; } else { return "application/octet-stream" ; } }
guess a content type from the url .
