2012-05-21 3 views
0

여기 내 구현품, 맞습니까?는 netty suport http (tcp 짧은 연결) 및 Google protobuf

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; 
} 
+0

작동합니까? 그것은 좋은 출발이 될 것입니다. – Nicholas

답변

0

작동하지 않습니다. HTTP 요청의 내용을 가져 와서 요청 내용 (ChannelBuffer)을 protobuf 메시지로 변환하는 처리기를 작성해야합니다. 다운 스트림에도 비슷한 작업이 필요합니다.