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

Java HttpResponseDecoder类代码示例

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

本文整理汇总了Java中org.jboss.netty.handler.codec.http.HttpResponseDecoder的典型用法代码示例。如果您正苦于以下问题:Java HttpResponseDecoder类的具体用法?Java HttpResponseDecoder怎么用?Java HttpResponseDecoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HttpResponseDecoder类属于org.jboss.netty.handler.codec.http包,在下文中一共展示了HttpResponseDecoder类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPipeline

import org.jboss.netty.handler.codec.http.HttpResponseDecoder; //导入依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = pipeline();

    pipeline.addLast("idle-detection", IDLE_STATE_HANDLER);
    pipeline.addLast("logging", new LoggingHandler(InternalLogLevel.DEBUG));
    pipeline.addLast("http-deflater", new HttpContentCompressor());
    pipeline.addLast("decoder", new HttpResponseDecoder(RESPONSE_MAX_INITIAL_LINE_LENGTH, RESPONSE_MAX_HEADER_SIZE, RESPONSE_MAX_CHUNK_SIZE));
    pipeline.addLast("encoder", new HttpRequestEncoder());
    pipeline.addLast("http-inflater", new HttpContentDecompressor());
    pipeline.addLast("remote-hop-timer", new ClientTimingHandler("outbound"));
    pipeline.addLast("exception-surfacer", EXCEPTION_SURFACER);
    pipeline.addLast("idle-watchdog", new IdleChannelWatchdog("outbound"));

    return pipeline;
}
 
开发者ID:neilbeveridge,项目名称:zuul-netty,代码行数:17,代码来源:HttpOutboundPipeline.java


示例2: initSendPipeline

import org.jboss.netty.handler.codec.http.HttpResponseDecoder; //导入依赖的package包/类
private void initSendPipeline(ChannelPipeline pipeline) {
	pipeline.addLast("reqencoder", new HttpRequestEncoder()); // downstream
	pipeline.addLast("respdecoder", new HttpResponseDecoder()); // upstream
	pipeline.addLast("aggregator", new HttpChunkAggregator(HttpTunnelMessageUtils.MAX_BODY_SIZE)); // upstream
	pipeline.addLast(HttpTunnelClientChannelProxyHandler.NAME, sendHttpHandler); // proxy auth, etc
	pipeline.addLast(HttpTunnelClientChannelSendHandler.NAME, sendHandler); // both
	pipeline.addLast("writeFragmenter", new WriteFragmenter(HttpTunnelMessageUtils.MAX_BODY_SIZE));
}
 
开发者ID:reines,项目名称:httptunnel,代码行数:9,代码来源:HttpTunnelClientChannel.java


示例3: initPollPipeline

import org.jboss.netty.handler.codec.http.HttpResponseDecoder; //导入依赖的package包/类
private void initPollPipeline(ChannelPipeline pipeline) {
	pipeline.addLast("reqencoder", new HttpRequestEncoder()); // downstream
	pipeline.addLast("respdecoder", new HttpResponseDecoder()); // upstream
	pipeline.addLast("aggregator", new HttpChunkAggregator(HttpTunnelMessageUtils.MAX_BODY_SIZE)); // upstream
	pipeline.addLast(HttpTunnelClientChannelProxyHandler.NAME, pollHttpHandler); // proxy auth, etc
	pipeline.addLast(HttpTunnelClientChannelPollHandler.NAME, pollHandler); // both
}
 
开发者ID:reines,项目名称:httptunnel,代码行数:8,代码来源:HttpTunnelClientChannel.java


示例4: connect

import org.jboss.netty.handler.codec.http.HttpResponseDecoder; //导入依赖的package包/类
public static ClientChannel connect(LoggerFactory loggerFactory, URI uri,
        int connectTimeoutMillis) throws ChannelException {
    Logger logger = loggerFactory.create(String.format("WebSocketClientHandler-%s", uri));

    WebSocketClientChannel clientChannel = new WebSocketClientChannel();
    clientChannel.setUri(uri);

    ConnectingChannelHandler handler = new ConnectingChannelHandler();
    clientChannel.setChannelHandler(handler);

    WebSocketClientUpstreamHandler wsHandler = new WebSocketClientUpstreamHandler(logger,
            clientChannel);
    ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("decoder", new HttpResponseDecoder());
    pipeline.addLast("encoder", new HttpRequestEncoder());
    // connect
    Channel channel = prepareAndConnect(logger, uri, pipeline, wsHandler,
            uri.getScheme().equalsIgnoreCase("wss"), connectTimeoutMillis);
    // handshake
    try {
        WebSocketClientHandshaker handshaker = wsFactory.newHandshaker(uri,
                WebSocketVersion.V13, null, true, WebSocketClientHelper.getHeaders(uri));
        wsHandler.handshaker = handshaker;
        handshaker.handshake(channel);
        // return maybe fast than call
        if (!wsHandler.handshaker.isHandshakeComplete() && (handler.error == null)) {
            synchronized (handler.syncObject) {
                handler.syncObject.wait(connectTimeoutMillis);
            }
        }
    } catch (Exception e) {
        throw new ChannelException(Text.WS_HANDSHAKE_ERROR, e);
    }

    if (wsHandler.handshaker.isHandshakeComplete()) {
        return clientChannel;
    }
    if (handler.error != null) {
        throw new ChannelException(Text.CONNECT_FAIL + ": " + handler.error.getMessage(),
                handler.error);
    }

    throw new ChannelException(Text.CONNECT_TIMEOUT);
}
 
开发者ID:kuiwang,项目名称:my-dev,代码行数:45,代码来源:WebSocketClient.java


示例5: NettyWSClient

import org.jboss.netty.handler.codec.http.HttpResponseDecoder; //导入依赖的package包/类
public NettyWSClient(String uriStr, WebSocketClient webSocketClient)
{
	
	this.t = webSocketClient;
	this.uri = URI.create(uriStr);
	

	String protocol = this.uri.getScheme();
	if (!protocol.equals("ws"))
	{
		throw new IllegalArgumentException("Unsupported protocol: " + protocol);
	}
	
	ClientBootstrap bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));
	
	Channel ch = null;

	HashMap<String, String> customHeaders = new HashMap<String, String>();
	customHeaders.put("MyHeader", "MyValue");
	
	// Connect with V13 (RFC 6455 aka HyBi-17). You can change it to V08 or V00.
	// If you change it to V00, ping is not supported and remember to change
	// HttpResponseDecoder to WebSocketHttpResponseDecoder in the pipeline.
	this.handshaker = new WebSocketClientHandshakerFactory().newHandshaker(this.uri, WebSocketVersion.V13, null, false, customHeaders);
	
	bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
		public ChannelPipeline getPipeline() throws Exception
		{
			ChannelPipeline pipeline = Channels.pipeline();
			
			pipeline.addLast("decoder", new HttpResponseDecoder());
			pipeline.addLast("encoder", new HttpRequestEncoder());
			pipeline.addLast("ws-handler", NettyWSClient.this);
			return pipeline;
		}
	});
	
	ChannelFuture future = bootstrap.connect(new InetSocketAddress(this.uri.getHost(), this.uri.getPort()));
	future.syncUninterruptibly();
	ch = future.getChannel();
	try
	{
		this.handshaker.handshake(ch);
	}
	catch (Exception e)
	{
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:EricssonResearch,项目名称:trap,代码行数:51,代码来源:NettyWSClient.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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