public enum Protocol extends Enum<Protocol >
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.
| Enum Constant and Description |
|---|
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.
|
HTTP_2
The IETF's binary-framed protocol that includes header compression, multiplexing multiple requests on the same socket, and server-push.
|
SPDY_3
Chromium's binary-framed protocol that includes header compression, multiplexing multiple requests on the same socket, and server-push.
|
| Modifier and Type | Method and Description |
|---|---|
static Protocol |
get(String
Returns the protocol identified by
protocol.
|
String |
toString()
Returns the string used to identify this protocol for ALPN, like "http/1.1", "spdy/3.1" or "h2".
|
static Protocol |
valueOf(String
Returns the enum constant of this type with the specified name.
|
static Protocol |
values()
Returns an array containing the constants of this enum type, in the order they are declared.
|
public static final ProtocolHTTP_1_0
public static final ProtocolHTTP_1_1
This version of OkHttp implements RFC 2616, and tracks revisions to that spec.
public static final ProtocolSPDY_3
This version of OkHttp implements SPDY 3 draft 3.1. Future releases of OkHttp may use this identifier for a newer draft of the SPDY spec.
public static final ProtocolHTTP_2
HTTP/2 requires deployments of HTTP/2 that use TLS 1.2 support CipherSuiteINADEQUATE_SECURITY.
public static Protocol[] values()
for (Protocol c : Protocol.values()) System.out.println(c);
public static ProtocolvalueOf(String name)
name - the name of the enum constant to be returned.
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null
public static Protocolget(String protocol) throws IOException
protocol.
IOException - if
protocol is unknown.
public StringtoString()