Java url Network Communication (2) -- protocol types supported by JAVA test URLs

Source: Internet
Author: User

Java url Network Communication (2) -- protocol types supported by JAVA test URLs
If you do not know the protocol types supported by the current virtual machine, you can refer to this article.
The test experiment in this paper is from: http://www.java2s.com/Tutorial/Java/0320__Network/ProtocolTester.htm

  1. Public class TestURLProtocol {

  2. Public static void main (String [] args ){
  3. String host = "www.baidu.com ";
  4. String file = "/index.html ";

  5. String [] schames = {"http", "https", "ftp", "mailto", "telnet", "file", "ldap", "gopher ",
  6. "Jdbc", "rmi", "jndi", "jar", "doc", "netdoc", "nfs", "verbatim", "finger", "daytime ", ""
  7. + "Systemresource "};
  8. For (int I = 0; I <schames. length; I ++ ){
  9. Try {
  10. URL url = new URL (schames [I], host, file );
  11. System. out. println (schames [I] + "is supported \ r \ n ");
  12. } Catch (MalformedURLException e ){
  13. // TODO Auto-generated catch block

  14. E. printStackTrace ();
  15. System. out. println (schames [I] + "is not supported \ r \ n ");
  16. }
  17. }

  18. }
The test results are as follows:

  1. Http is supported

  2. Https is supported

  3. Ftp is supported

  4. Mailto is supported

  5. Java.net. MalformedURLException: unknown protocol: telnet
  6. At java.net. URL. <init> (URL. java: 413)
  7. At java.net. URL. <init> (URL. java: 302)
  8. At java.net. URL. <init> (URL. java: 325)
  9. At urlSample. TestURLProtocol. main (TestURLProtocol. java: 17)
  10. Telnet is not supported

  11. File is supported

  12. Java.net. MalformedURLException: unknown protocol: ldap
  13. At java.net. URL. <init> (URL. java: 413)
  14. At java.net. URL. <init> (URL. java: 302)
  15. At java.net. URL. <init> (URL. java: 325) ldap is not supported

  16. Gopher is not supported

  17. Jdbc is not supported

  18. Rmi is not supported

  19. Jndi is not supported

  20. Jar is supported


  21. At urlSample. TestURLProtocol. main (TestURLProtocol. java: 17)
  22. Java.net. MalformedURLException: unknown protocol: gopher
  23. At java.net. URL. <init> (URL. java: 413)
  24. At java.net. URL. <init> (URL. java: 302)
  25. At java.net. URL. <init> (URL. java: 325)
  26. At urlSample. TestURLProtocol. main (TestURLProtocol. java: 17)
  27. Java.net. MalformedURLException: unknown protocol: jdbc
  28. At java.net. URL. <init> (URL. java: 413)
  29. At java.net. URL. <init> (URL. java: 302)
  30. At java.net. URL. <init> (URL. java: 325)
  31. At urlSample. TestURLProtocol. main (TestURLProtocol. java: 17)
  32. Java.net. MalformedURLException: unknown protocol: rmi
  33. At java.net. URL. <init> (URL. java: 413)
  34. At java.net. URL. <init> (URL. java: 302)
  35. At java.net. URL. <init> (URL. java: 325)
  36. At urlSample. TestURLProtocol. main (TestURLProtocol. java: 17)
  37. Java.net. MalformedURLException: unknown protocol: jndi
  38. At java.net. URL. <init> (URL. java: 413)
  39. At java.net. URL. <init> (URL. java: 302)
  40. At java.net. URL. <init> (URL. java: 325)
  41. At urlSample. TestURLProtocol. main (TestURLProtocol. java: 17)
  42. Java.net. MalformedURLException: unknown protocol: doc
  43. At java.net. URL. <init> (URL. java: 413)
  44. At java.net. URL. <init> (URL. java: 302)
  45. At java.net. URL. <init> (URL. java: 325)
  46. At urlSample. TestURLProtocol. main (TestURLProtocol. java: 17)
  47. Doc is not supported

  48. Netdoc is supported

  49. Java.net. MalformedURLException: unknown protocol: nfs
  50. At java.net. URL. <init> (URL. java: 413)
  51. At java.net. URL. <init> (URL. java: 302)
  52. At java.net. URL. <init> (URL. java: 325)
  53. At urlSample. TestURLProtocol. main (TestURLProtocol. java: 17)
  54. Nfs is not supported

  55. Java.net. MalformedURLException: unknown protocol: verbatim
  56. At java.net. URL. <init> (URL. java: 413)
  57. At java.net. URL. <init> (URL. java: 302)
  58. At java.net. URL. <init> (URL. java: 325)
  59. At urlSample. TestURLProtocol. main (TestURLProtocol. java: 17)
  60. Verbatim is not supported

  61. Java.net. MalformedURLException: unknown protocol: finger
  62. At java.net. URL. <init> (URL. java: 413)
  63. At java.net. URL. <init> (URL. java: 302)
  64. At java.net. URL. <init> (URL. java: 325)
  65. At urlSample. TestURLProtocol. main (TestURLProtocol. java: 17)
  66. Finger is not supported

  67. Java.net. MalformedURLException: unknown protocol: daytime
  68. At java.net. URL. <init> (URL. java: 413)
  69. At java.net. URL. <init> (URL. java: 302)
  70. At java.net. URL. <init> (URL. java: 325)
  71. At urlSample. TestURLProtocol. main (TestURLProtocol. java: 17)
  72. Daytime is not supported

  73. Java.net. MalformedURLException: unknown protocol: systemresource
  74. At java.net. URL. <init> (URL. java: 413)
  75. At java.net. URL. <init> (URL. java: 302)
  76. At java.net. URL. <init> (URL. java: 325)
  77. At urlSample. TestURLProtocol. main (TestURLProtocol. java: 17)
  78. Systemresource is not supported


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.