public enum Protocol extends Enum<Protocol>
URL.getProtocol()
返回scheme (http, https, etc.),
而不是协议(http/1.1, spdy/3.1,等等) 请使用这个协议来识别它是如何被分割的
Httpd使用协议这个词来标识HTTP消息是如何构造的| Enum Constant and Description |
|---|
H2_PRIOR_KNOWLEDGE
明文HTTP/2,没有"upgrade"往返。此选项要求客户端事先知道服务器支持明文HTTP/2
|
HTTP_1_0
一种过时的plaintext,默认情况下不使用持久套接字
|
HTTP_1_1
包含持久连接的plaintext
此版本的Httpd实现了RFC 7230,并跟踪对该规范的修订
|
HTTP_2
IETF的二进制框架协议,包括头压缩、在同一个套接字上多路复用多个请求和服务器推送
HTTP/1.1语义是在HTTP/2上分层的.
|
QUIC
QUIC(快速UDP互联网连接)是一个新的多路复用和UDP之上的安全传输,
从底层设计和优化的HTTP/2语义。HTTP/1.1语义是在HTTP/2上分层的
|
SPDY_3
Chromium的二进制框架协议,包括标头压缩、在同一个套接字上多路复用多个请求和服务器推送
HTTP/1.1语义在SPDY/3上分层.
|
| Modifier and Type | Method and Description |
|---|---|
static Protocol |
get(String protocol) |
String |
toString()
返回用于识别ALPN协议的字符串,如“http/1.1”、“spdy/3.1”或“http/2.0”.
|
static Protocol |
valueOf(String name)
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 Protocol HTTP_1_0
public static final Protocol HTTP_1_1
public static final Protocol SPDY_3
public static final Protocol HTTP_2
public static final Protocol H2_PRIOR_KNOWLEDGE
public static final Protocol QUIC
public static Protocol[] values()
for (Protocol c : Protocol.values()) System.out.println(c);
public static Protocol valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static Protocol get(String protocol) throws IOException
protocol - 协议标示protocol标识的协议IOException - if protocol is unknown.Copyright © 2020. All rights reserved.