【问题标题】:can netty suport http (tcp short connection) and Google protobufnetty 能否支持 http(tcp 短连接)和 Google protobuf
【发布时间】:2012-05-28 04:27:21
【问题描述】:

这是我的工具,对吗?

public ChannelPipeline getPipeline() throws Exception 
{
    ChannelPipeline p = pipeline();
    pipeline.addLast("decoder", new HttpRequestDecoder());
    p.addLast("frameDecoder", new ProtobufVarint32FrameDecoder());
    p.addLast("protobufDecoder", new ProtobufDecoder(LocalTimeProtocol.Locations.getDefaultInstance()));
    pipeline.addLast("encoder", new HttpResponseEncoder());
    p.addLast("frameEncoder", new ProtobufVarint32LengthFieldPrepender());
    p.addLast("protobufEncoder", new ProtobufEncoder());
    p.addLast("handler", new LocalTimeServerHandler());
    return p;
}

【问题讨论】:

  • 有效吗?这将是一个好的开始。

标签: http netty protocol-buffers google-ajax-libraries


【解决方案1】:

它不会起作用。您必须编写一个处理程序来获取 HTTP 请求的内容并将请求的内容 (ChannelBuffer) 转换为 protobuf 消息。下游也需要做类似的工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-02-26
    • 1970-01-01
    • 1970-01-01
    • 2010-12-01
    • 1970-01-01
    • 2018-11-25
    • 2012-12-06
    相关资源
    最近更新 更多