Enum Class Protocol

java.lang.Object
java.lang.Enum<Protocol>
org.miaixz.bus.core.net.Protocol
All Implemented Interfaces:
Serializable, Comparable<Protocol>, Constable

public enum Protocol extends Enum<Protocol>
协议vs计划 它的名字是:URL.getProtocol() 返回scheme (http, https, etc.), 而不是协议(http/1.1, spdy/3.1,等等) 请使用这个协议来识别它是如何被分割的 Httpd使用协议这个词来标识HTTP消息是如何构造的
Since:
Java 17+
Author:
Kimi Liu
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
     
    明文HTTP/2,没有"upgrade"往返。此选项要求客户端事先知道服务器支持明文HTTP/2
     
    http协议
    过时的plaintext,默认情况下不使用持久套接字
    包含持久连接的plaintext 此版本的Httpd实现了RFC 7230,并跟踪对该规范的修订
    IETF的二进制框架协议,包括头压缩、在同一个套接字上多路复用多个请求和服务器推送 HTTP/1.1语义是在HTTP/2上分层的
    HTTP/3 是用于交换信息的超文本传输协议的第三个主要版本 HTTP/3 在 QUIC 上运行,QUIC 以 RFC 9000 的形式发布。
    https协议
    QUIC(快速UDP互联网连接)是一个新的多路复用和UDP之上的安全传输, 从底层设计和优化的HTTP/2语义。HTTP/1.1语义是在HTTP/2上分层的
    SOAP 1.1协议
    SOAP 1.2协议
    Chromium的二进制框架协议,包括标头压缩、在同一个套接字上多路复用多个请求和服务器推送 HTTP/1.1语义在SPDY/3上分层.
    Supports some version of SSL
    Supports SSL version 2
    Supports SSL version 3
    TCP协议
    Supports some version of TLS
    Supports RFC 2246: TLS version 1.0
    Supports RFC 4346: TLS version 1.1
    Supports RFC 5246: TLS version 1.2
    Supports RFC 5246: TLS version 1.3
     
    the ws
    the wss
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The IPV4 127.0.0.1
    static final String
    The localhost
    static final String
    The prefix http
    static final String
    The prefix https
    static final long
    Ipv4最大值数值形式
    static final String
    Ipv4地址最大值字符串形式
    static final String
    Ipv4地址最小值字符串形式
    static final String
    Ipv4未使用地址最大值字符串形式
    final String
     
    static final String
    The prefix ws
    static final String
    The prefix wss
  • Method Summary

    Modifier and Type
    Method
    Description
    static Protocol
    get(String protocol)
     
    static boolean
    是否为http协议
    static boolean
    是否为https协议
    static boolean
    是否为https协议或本地主机(域名)
    static boolean
    是否为本地主机(域名)
    boolean
     
    返回用于识别ALPN协议的字符串,如“http/1.1”、“spdy/3.1”或“http/2.0”.
    static Protocol
    Returns the enum constant of this class with the specified name.
    static Protocol[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • TCP

      public static final Protocol TCP
      TCP协议
    • UDP

      public static final Protocol UDP
    • HTTP

      public static final Protocol HTTP
      http协议
    • HTTP_1_0

      public static final Protocol HTTP_1_0
      过时的plaintext,默认情况下不使用持久套接字
    • HTTP_1_1

      public static final Protocol HTTP_1_1
      包含持久连接的plaintext 此版本的Httpd实现了RFC 7230,并跟踪对该规范的修订
    • HTTP_2

      public static final Protocol HTTP_2
      IETF的二进制框架协议,包括头压缩、在同一个套接字上多路复用多个请求和服务器推送 HTTP/1.1语义是在HTTP/2上分层的
    • HTTP_3

      public static final Protocol HTTP_3
      HTTP/3 是用于交换信息的超文本传输协议的第三个主要版本 HTTP/3 在 QUIC 上运行,QUIC 以 RFC 9000 的形式发布。
    • SPDY_3

      public static final Protocol SPDY_3
      Chromium的二进制框架协议,包括标头压缩、在同一个套接字上多路复用多个请求和服务器推送 HTTP/1.1语义在SPDY/3上分层.
    • H2_PRIOR_KNOWLEDGE

      public static final Protocol H2_PRIOR_KNOWLEDGE
      明文HTTP/2,没有"upgrade"往返。此选项要求客户端事先知道服务器支持明文HTTP/2
    • QUIC

      public static final Protocol QUIC
      QUIC(快速UDP互联网连接)是一个新的多路复用和UDP之上的安全传输, 从底层设计和优化的HTTP/2语义。HTTP/1.1语义是在HTTP/2上分层的
    • SOAP_1_1

      public static final Protocol SOAP_1_1
      SOAP 1.1协议
    • SOAP_1_2

      public static final Protocol SOAP_1_2
      SOAP 1.2协议
    • WS

      public static final Protocol WS
      the ws
    • WSS

      public static final Protocol WSS
      the wss
    • HTTPS

      public static final Protocol HTTPS
      https协议
    • SSL

      public static final Protocol SSL
      Supports some version of SSL
    • SSLv2

      public static final Protocol SSLv2
      Supports SSL version 2
    • SSLv3

      public static final Protocol SSLv3
      Supports SSL version 3
    • TLS

      public static final Protocol TLS
      Supports some version of TLS
    • TLSv1

      public static final Protocol TLSv1
      Supports RFC 2246: TLS version 1.0
    • TLSv1_1

      public static final Protocol TLSv1_1
      Supports RFC 4346: TLS version 1.1
    • TLSv1_2

      public static final Protocol TLSv1_2
      Supports RFC 5246: TLS version 1.2
    • TLSv1_3

      public static final Protocol TLSv1_3
      Supports RFC 5246: TLS version 1.3
    • DICOM

      public static final Protocol DICOM
    • HL7

      public static final Protocol HL7
  • Field Details

    • HTTP_PREFIX

      public static final String HTTP_PREFIX
      The prefix http
    • HTTPS_PREFIX

      public static final String HTTPS_PREFIX
      The prefix https
    • WS_PREFIX

      public static final String WS_PREFIX
      The prefix ws
    • WSS_PREFIX

      public static final String WSS_PREFIX
      The prefix wss
    • HOST_IPV4

      public static final String HOST_IPV4
      The IPV4 127.0.0.1
      See Also:
    • HOST_LOCAL

      public static final String HOST_LOCAL
      The localhost
      See Also:
    • IPV4_STR_MIN

      public static final String IPV4_STR_MIN
      Ipv4地址最小值字符串形式
      See Also:
    • IPV4_STR_MAX

      public static final String IPV4_STR_MAX
      Ipv4地址最大值字符串形式
      See Also:
    • IPV4_NUM_MAX

      public static final long IPV4_NUM_MAX
      Ipv4最大值数值形式
      See Also:
    • IPV4_UNUSED_STR_MAX

      public static final String IPV4_UNUSED_STR_MAX
      Ipv4未使用地址最大值字符串形式
      See Also:
    • name

      public final String name
  • Method Details

    • values

      public static Protocol[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Protocol valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • get

      public static Protocol get(String protocol) throws IOException
      Parameters:
      protocol - 协议标示
      Returns:
      返回由protocol标识的协议
      Throws:
      IOException - if protocol is unknown.
    • isHttp

      public static boolean isHttp(String url)
      是否为http协议
      Parameters:
      url - 待验证的url
      Returns:
      true: http协议, false: 非http协议
    • isHttps

      public static boolean isHttps(String url)
      是否为https协议
      Parameters:
      url - 待验证的url
      Returns:
      true: https协议, false: 非https协议
    • isLocalHost

      public static boolean isLocalHost(String url)
      是否为本地主机(域名)
      Parameters:
      url - 待验证的url
      Returns:
      true: 本地主机(域名), false: 非本地主机(域名)
    • isHttpsOrLocalHost

      public static boolean isHttpsOrLocalHost(String url)
      是否为https协议或本地主机(域名)
      Parameters:
      url - 待验证的url
      Returns:
      true: https协议或本地主机 false: 非https协议或本机主机
    • isTcp

      public boolean isTcp()
    • toString

      public String toString()
      返回用于识别ALPN协议的字符串,如“http/1.1”、“spdy/3.1”或“http/2.0”.
      Overrides:
      toString in class Enum<Protocol>