SpdyOrHttpHandler Class — netty Architecture
Architecture documentation for the SpdyOrHttpHandler class in SpdyOrHttpHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 358d8f69_4752_847f_9b3c_ad349643d236["SpdyOrHttpHandler"] 151039f5_e264_1045_1493_8fe59c605955["SpdyOrHttpHandler.java"] 358d8f69_4752_847f_9b3c_ad349643d236 -->|defined in| 151039f5_e264_1045_1493_8fe59c605955 77066375_79a8_6fcb_8f4c_73350b3b4cbe["SpdyOrHttpHandler()"] 358d8f69_4752_847f_9b3c_ad349643d236 -->|method| 77066375_79a8_6fcb_8f4c_73350b3b4cbe bbd1c066_2618_996a_57b4_0aaae86691da["configurePipeline()"] 358d8f69_4752_847f_9b3c_ad349643d236 -->|method| bbd1c066_2618_996a_57b4_0aaae86691da cf8c2885_2362_85c5_fcbf_aaae849b17d4["configureSpdy()"] 358d8f69_4752_847f_9b3c_ad349643d236 -->|method| cf8c2885_2362_85c5_fcbf_aaae849b17d4 bff4ba6a_a3f7_fa3c_a3c3_43fa883aceb8["configureHttp1()"] 358d8f69_4752_847f_9b3c_ad349643d236 -->|method| bff4ba6a_a3f7_fa3c_a3c3_43fa883aceb8
Relationship Graph
Source Code
example/src/main/java/io/netty/example/spdy/server/SpdyOrHttpHandler.java lines 35–74
public class SpdyOrHttpHandler extends ApplicationProtocolNegotiationHandler {
private static final int MAX_CONTENT_LENGTH = 1024 * 100;
protected SpdyOrHttpHandler() {
super(ApplicationProtocolNames.HTTP_1_1);
}
@Override
protected void configurePipeline(ChannelHandlerContext ctx, String protocol) throws Exception {
if (ApplicationProtocolNames.SPDY_3_1.equals(protocol)) {
configureSpdy(ctx, SpdyVersion.SPDY_3_1);
return;
}
if (ApplicationProtocolNames.HTTP_1_1.equals(protocol)) {
configureHttp1(ctx);
return;
}
throw new IllegalStateException("unknown protocol: " + protocol);
}
private static void configureSpdy(ChannelHandlerContext ctx, SpdyVersion version) throws Exception {
ChannelPipeline p = ctx.pipeline();
p.addLast(new SpdyFrameCodec(version));
p.addLast(new SpdySessionHandler(version, true));
p.addLast(new SpdyHttpEncoder(version));
p.addLast(new SpdyHttpDecoder(version, MAX_CONTENT_LENGTH));
p.addLast(new SpdyHttpResponseStreamIdHandler());
p.addLast(new SpdyServerHandler());
}
private static void configureHttp1(ChannelHandlerContext ctx) throws Exception {
ChannelPipeline p = ctx.pipeline();
p.addLast(new HttpServerCodec());
p.addLast(new HttpObjectAggregator(MAX_CONTENT_LENGTH));
p.addLast(new SpdyServerHandler());
}
}
Source
Frequently Asked Questions
What is the SpdyOrHttpHandler class?
SpdyOrHttpHandler is a class in the netty codebase, defined in example/src/main/java/io/netty/example/spdy/server/SpdyOrHttpHandler.java.
Where is SpdyOrHttpHandler defined?
SpdyOrHttpHandler is defined in example/src/main/java/io/netty/example/spdy/server/SpdyOrHttpHandler.java at line 35.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free