枚举类 Protocol
- 所有已实现的接口:
Serializable,Comparable<Protocol>,java.lang.constant.Constable
Protocols that OkHttp implements for ALPN
selection.
Protocol vs Scheme
Despite its name,URL.getProtocol() returns the
scheme (http, https, etc.) of the URL, not the protocol
(http/1.1, spdy/3.1, etc.). OkHttp uses the word protocol to identify how HTTP messages
are framed.-
嵌套类概要
从类继承的嵌套类/接口 java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
枚举常量概要
枚举常量枚举常量说明Cleartext HTTP/2 with no "upgrade" round trip.An obsolete plaintext framing that does not use persistent sockets by default.A plaintext framing that includes persistent connections.The IETF's binary-framed protocol that includes header compression, multiplexing multiple requests on the same socket, and server-push.QUIC (Quick UDP Internet Connection) is a new multiplexed and secure transport atop UDP, designed from the ground up and optimized for HTTP/2 semantics.已过时。OkHttp has dropped support for SPDY. -
方法概要
从类继承的方法 java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
-
枚举常量详细资料
-
HTTP_1_0
An obsolete plaintext framing that does not use persistent sockets by default. -
HTTP_1_1
A plaintext framing that includes persistent connections.This version of OkHttp implements RFC 7230, and tracks revisions to that spec.
-
SPDY_3
已过时。OkHttp has dropped support for SPDY. PreferHTTP_2.Chromium's binary-framed protocol that includes header compression, multiplexing multiple requests on the same socket, and server-push. HTTP/1.1 semantics are layered on SPDY/3.Current versions of OkHttp do not support this protocol.
-
HTTP_2
The IETF's binary-framed protocol that includes header compression, multiplexing multiple requests on the same socket, and server-push. HTTP/1.1 semantics are layered on HTTP/2.HTTP/2 requires deployments of HTTP/2 that use TLS 1.2 support CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 , present in Java 8+ and Android 5+. Servers that enforce this may send an exception message including the string
INADEQUATE_SECURITY. -
H2_PRIOR_KNOWLEDGE
Cleartext HTTP/2 with no "upgrade" round trip. This option requires the client to have prior knowledge that the server supports cleartext HTTP/2.- 另请参阅:
-
QUIC
QUIC (Quick UDP Internet Connection) is a new multiplexed and secure transport atop UDP, designed from the ground up and optimized for HTTP/2 semantics. HTTP/1.1 semantics are layered on HTTP/2.QUIC is not natively supported by OkHttp, but provided to allow a theoretical interceptor that provides support.
-
-
方法详细资料
-
values
返回包含该枚举类的常量的数组, 顺序与声明这些常量的顺序相同- 返回:
- 包含该枚举类的常量的数组,顺序与声明这些常量的顺序相同
-
valueOf
返回带有指定名称的该类的枚举常量。 字符串必须与用于声明该类的枚举常量的 标识符完全匹配。(不允许有多余 的空格字符。)- 参数:
name- 要返回的枚举常量的名称。- 返回:
- 返回带有指定名称的枚举常量
- 抛出:
IllegalArgumentException- 如果该枚举类没有带有指定名称的常量NullPointerException- 如果参数为空值
-
get
Returns the protocol identified byprotocol.- 抛出:
IOException- ifprotocolis unknown.
-
toString
Returns the string used to identify this protocol for ALPN, like "http/1.1", "spdy/3.1" or "h2".
-