本文整理汇总了Java中io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler类的典型用法代码示例。如果您正苦于以下问题:Java WebSocketServerCompressionHandler类的具体用法?Java WebSocketServerCompressionHandler怎么用?Java WebSocketServerCompressionHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WebSocketServerCompressionHandler类属于io.netty.handler.codec.http.websocketx.extensions.compression包,在下文中一共展示了WebSocketServerCompressionHandler类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initChannel
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler; //导入依赖的package包/类
@Override
public void initChannel(SocketChannel ch) {
ChannelPipeline p = ch.pipeline();
p.addLast(new ReadTimeoutHandler(60, TimeUnit.SECONDS));
if (sslContext != null) {
p.addLast(sslContext.newHandler(ch.alloc()));
}
p.addLast(new HttpContentCompressor(5));
p.addLast(new HttpServerCodec());
p.addLast(new HttpObjectAggregator(1048576));
p.addLast(new ChunkedWriteHandler());
if (null != corsConfig) {
p.addLast(new CorsHandler(corsConfig));
}
p.addLast(new WebSocketServerCompressionHandler());
p.addLast(new WebSocketServerProtocolHandler(webSocketPath, null, true));
p.addLast(new LaputaServerHandler(null != sslContext, requestProcessor));
}
示例2: switchToHttp
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler; //导入依赖的package包/类
private void switchToHttp(ChannelHandlerContext ctx) {
ChannelPipeline p = ctx.pipeline();
p.addLast(new HttpServerCodec());
p.addLast(new HttpObjectAggregator(65536));
p.addLast(new WebSocketServerCompressionHandler());
p.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, "ws", true));
p.addLast(new NetoJsonStringToMapWebSocketDecoder());
p.addLast(new NetoMessageToWebsocketFrameEncoder());
p.remove(this);
// 핸들러를 다시 등록 했으므로 이벤트를 전파
ctx.fireChannelActive();
}
示例3: initChannel
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler; //导入依赖的package包/类
@Override
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
if (sslCtx != null) {
pipeline.addLast(sslCtx.newHandler(ch.alloc()));
}
pipeline.addLast(new HttpServerCodec());
pipeline.addLast(new HttpObjectAggregator(65536));
pipeline.addLast(new WebSocketServerCompressionHandler());
pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, "binary", true));
pipeline.addLast(new WebSocketIndexPageHandler(pluginDataFolder));
pipeline.addLast(new WebSocketFrameHandler(webSocketServerThread, checkIPBans));
}
示例4: initPipeline
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler; //导入依赖的package包/类
@Override
protected void initPipeline(ChannelPipeline pipeline) {
pipeline.addLast(new HttpServerCodec());
pipeline.addLast(new HttpObjectAggregator(65536));
pipeline.addLast(new WebSocketServerCompressionHandler());
pipeline.addLast(new WebSocketServerProtocolHandler(CC.mp.net.ws_path, null, true));
pipeline.addLast(new WebSocketIndexPageHandler());
pipeline.addLast(getChannelHandler());
}
示例5: initChannel
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler; //导入依赖的package包/类
/**
* 채널 파이프라인 설정.
* Netty.Server.Configuration.NettyServerConfiguration 에서 등록한 Bean 을 이용해 사용자의 통신을 처리할 Handler 도 등록.
* Netty.Server.Handler.JsonHandler 에서 실제 사용자 요청 처리.
*
* @param channel
* @throws Exception
*/
@Override
protected void initChannel(Channel channel) throws Exception {
ChannelPipeline channelPipeline = channel.pipeline();
switch (transferType) {
case "websocket":
channelPipeline
.addLast(new HttpServerCodec())
.addLast(new HttpObjectAggregator(65536))
.addLast(new WebSocketServerCompressionHandler())
.addLast(new WebSocketServerProtocolHandler(transferWebsocketPath, transferWebsocketSubProtocol, transferWebsocketAllowExtensions))
.addLast(new LoggingHandler(LogLevel.valueOf(logLevelPipeline)))
.addLast(websocketHandler);
case "tcp":
default:
channelPipeline
.addLast(new LineBasedFrameDecoder(Integer.MAX_VALUE))
.addLast(STRING_DECODER)
.addLast(STRING_ENCODER)
.addLast(new LoggingHandler(LogLevel.valueOf(logLevelPipeline)))
.addLast(jsonHandler);
}
}
示例6: initChannel
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler; //导入依赖的package包/类
@Override
protected void initChannel(final SocketChannel ch) throws Exception {
final ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast(new HttpServerCodec());
pipeline.addLast(new HttpObjectAggregator(65536));
pipeline.addLast(new WebSocketServerCompressionHandler());
pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true));
pipeline.addLast(webSockServiceHandler);
}
示例7: initChannel
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler; //导入依赖的package包/类
@Override
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
if (sslCtx != null) {
pipeline.addLast(sslCtx.newHandler(ch.alloc()));
}
pipeline.addLast(new HttpServerCodec());
pipeline.addLast(new HttpObjectAggregator(65536));
pipeline.addLast(new WebSocketServerCompressionHandler());
pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, subProtocols, true));
pipeline.addLast(new WebSocketRemoteServerFrameHandler());
}
示例8: apply
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler; //导入依赖的package包/类
@Override
public void apply(ChannelPipeline pipeline){
pipeline.channel().config().setAutoRead(true);
pipeline.addLast(new HttpServerCodec());
pipeline.addLast(new HttpObjectAggregator(65536));
if(Config.getInstance().isCompressionEnabled()){
pipeline.addLast(new WebSocketServerCompressionHandler());
}
pipeline.addLast(guicer.inject(new WebSocketValidationHandler()));
pipeline.addLast(guicer.inject(new WebSocketServerHandler()));
}
示例9: initChannel
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler; //导入依赖的package包/类
@Override
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
if (sslCtx != null) {
pipeline.addLast(sslCtx.newHandler(ch.alloc()));
}
pipeline.addLast(new HttpServerCodec());
pipeline.addLast(new HttpObjectAggregator(65536));
pipeline.addLast(new WebSocketServerCompressionHandler());
pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true));
pipeline.addLast(new WebSocketIndexPageHandler(WEBSOCKET_PATH));
pipeline.addLast(new WebSocketFrameHandler());
}
示例10: initChannel
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler; //导入依赖的package包/类
@Override
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
if (sslCtx != null) {
pipeline.addLast(sslCtx.newHandler(ch.alloc()));
}
pipeline.addLast(new HttpServerCodec());
pipeline.addLast(new HttpObjectAggregator(65536));
pipeline.addLast(new WebSocketServerCompressionHandler());
pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true));
pipeline.addLast(new WebSocketIndexPageHandler(WEBSOCKET_PATH));
pipeline.addLast(new TextWebSocketFrameHandler());
}
示例11: initChannel
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler; //导入依赖的package包/类
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast(new HttpServerCodec());
pipeline.addLast(new HttpObjectAggregator(65536));
pipeline.addLast(new WebSocketServerCompressionHandler());
pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true));
pipeline.addLast(new WatcherServerIndexPageHandler(WEBSOCKET_PATH));
pipeline.addLast(new WatcherServerHandler());
}
示例12: initChannel
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler; //导入依赖的package包/类
@Override
protected void initChannel(Channel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
// Flash policy file
if (isFlashSupported) {
pipeline.addLast(FLASH_POLICY_HANDLER, flashPolicyHandler);
}
// SSL
if (sslContext != null) {
pipeline.addLast(SSL_HANDLER, sslContext.newHandler(ch.alloc()));
}
// HTTP
pipeline.addLast(HTTP_REQUEST_DECODER, new HttpRequestDecoder());
pipeline.addLast(HTTP_CHUNK_AGGREGATOR, new HttpObjectAggregator(MAX_HTTP_CONTENT_LENGTH));
pipeline.addLast(HTTP_RESPONSE_ENCODER, new HttpResponseEncoder());
if (isHttpCompressionEnabled) {
pipeline.addLast(HTTP_COMPRESSION, new HttpContentCompressor());
}
// Flash resources
if (isFlashSupported) {
pipeline.addLast(FLASH_RESOURCE_HANDLER, flashResourceHandler);
}
// Socket.IO
pipeline.addLast(SOCKETIO_PACKET_ENCODER, packetEncoderHandler);
pipeline.addLast(SOCKETIO_HANDSHAKE_HANDLER, handshakeHandler);
pipeline.addLast(SOCKETIO_DISCONNECT_HANDLER, disconnectHandler);
if (isWebsocketCompressionEnabled) {
pipeline.addLast(WEBSOCKET_COMPRESSION, new WebSocketServerCompressionHandler());
}
pipeline.addLast(SOCKETIO_WEBSOCKET_HANDLER, webSocketHandler);
if (isFlashSupported) {
pipeline.addLast(SOCKETIO_FLASHSOCKET_HANDLER, flashSocketHandler);
}
pipeline.addLast(SOCKETIO_XHR_POLLING_HANDLER, xhrPollingHandler);
if (isJsonpSupported) {
pipeline.addLast(SOCKETIO_JSONP_POLLING_HANDLER, jsonpPollingHandler);
}
pipeline.addLast(SOCKETIO_HEARTBEAT_HANDLER, heartbeatHandler);
pipeline.addLast(eventExecutorGroup, SOCKETIO_PACKET_DISPATCHER, packetDispatcherHandler);
if (pipelineModifier != null) {
pipelineModifier.modifyPipeline(pipeline);
}
}