public class SpdyHttpEncoder extends MessageToMessageEncoder<HttpObject>
HttpRequest
s, HttpResponse
s和HttpContent
s分成SpdySynStreamFrame
s和SpdySynReplyFrame
s。
HttpRequest
s:
Header Name Header Value "X-SPDY-Stream-ID"
The Stream-ID for this request. Stream-IDs must be odd, positive integers, and must increase monotonically. "X-SPDY-Priority"
The priority value for this request. The priority should be between 0 and 7 inclusive. 0 represents the highest priority and 7 represents the lowest. This header is optional and defaults to 0.
HttpResponse
s:
Header Name Header Value "X-SPDY-Stream-ID"
The Stream-ID of the request corresponding to this response.
HttpRequest
s:
Header Name Header Value "X-SPDY-Stream-ID"
The Stream-ID for this resource. Stream-IDs must be even, positive integers, and must increase monotonically. "X-SPDY-Associated-To-Stream-ID"
The Stream-ID of the request that initiated this pushed resource. "X-SPDY-Priority"
The priority value for this resource. The priority should be between 0 and 7 inclusive. 0 represents the highest priority and 7 represents the lowest. This header is optional and defaults to 0.
"X-SPDY-Scheme"
头设置,但默认为“https”,因为这是最常见的SPDY部署。
HttpContent
与最近接收的“分块” HttpRequest
或HttpResponse
相关联 。
ChannelHandler.Sharable
Constructor and Description |
---|
SpdyHttpEncoder(SpdyVersion version)
创建一个新的实例。
|
SpdyHttpEncoder(SpdyVersion version, boolean headersToLowerCase, boolean validateHeaders)
创建一个新的实例。
|
Modifier and Type | Method and Description |
---|---|
protected void |
encode(ChannelHandlerContext ctx, HttpObject msg, java.util.List<java.lang.Object> out)
从一条消息编码到另一条消息。
|
acceptOutboundMessage, write
bind, close, connect, deregister, disconnect, flush, read
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerAdded, handlerRemoved
public SpdyHttpEncoder(SpdyVersion version)
version
- 协议版本
public SpdyHttpEncoder(SpdyVersion version, boolean headersToLowerCase, boolean validateHeaders)
version
- 协议版本
headersToLowerCase
- 将标题名称转换为小写。
在受控环境中,可以禁用转换。
validateHeaders
- 将它们添加到SpdyHeaders
时验证标题名称和值
protected void encode(ChannelHandlerContext ctx, HttpObject msg, java.util.List<java.lang.Object> out) throws java.lang.Exception
MessageToMessageEncoder
encode
在课堂
MessageToMessageEncoder<HttpObject>
ctx
- MessageToMessageEncoder
属于的ChannelHandlerContext
msg
- 要编码到另一个的消息
out
- 应该添加编码味精的
List
需要做某种聚合
java.lang.Exception
- 发生错误时抛出
Copyright © 2008–2018 The Netty Project. All rights reserved.