• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java WebSocketServerCompressionHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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));
}
 
开发者ID:orctom,项目名称:laputa,代码行数:19,代码来源:LaputaServerInitializer.java


示例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();
}
 
开发者ID:veritasware,项目名称:neto,代码行数:14,代码来源:ProtocolUnificationHandler.java


示例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));
}
 
开发者ID:satoshinm,项目名称:WebSandboxMC,代码行数:14,代码来源:WebSocketServerInitializer.java


示例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());
}
 
开发者ID:mpusher,项目名称:mpush,代码行数:10,代码来源:WebsocketServer.java


示例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);

	}

}
 
开发者ID:zepinos,项目名称:ChatServer,代码行数:39,代码来源:NettyChannelInitializer.java


示例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);
       		
}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:11,代码来源:RPCServer.java


示例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());
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:13,代码来源:WebSocketRemoteServerInitializer.java


示例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()));
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:12,代码来源:WebSocketPipelineBuilder.java


示例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());
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:14,代码来源:WebSocketServerInitializer.java


示例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());
}
 
开发者ID:nifeng1989,项目名称:Netty-WebSocket,代码行数:14,代码来源:WebSocketServerInitializer.java


示例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());
}
 
开发者ID:herowzz,项目名称:SimLogMonitor,代码行数:11,代码来源:WatcherChannelInitializer.java


示例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);
  }
}
 
开发者ID:scalecube,项目名称:socketio,代码行数:48,代码来源:SocketIOChannelInitializer.java



注:本文中的io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExceptionQueuedEventContext类代码示例发布时间:2022-05-21
下一篇:
Java AbstractVerticle类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap