0
我在使用netty 4.1.9从服务器接收来自Netty客户端的XML消息。客户端能够将xml消息发送到服务器。但是,在服务器端,我需要能够将它们解码为单个xml消息(而不是一系列字节)。我看着xml帧解码器,但无法弄清楚最好的方法。希望指出正确的方向。使用netty 4.1.9进行xml消息处理
初始化程序:
@Override
public void initChannel(SocketChannel ch) throws Exception {
log.info("init channel called");
ChannelPipeline pipeline = ch.pipeline();
//add decoder for combining bytes for xml message
pipeline.addLast("decoder", new XmlMessageDecoder());
// handler for business logic.
pipeline.addLast("handler", new XmlServerHandler());
}
我不能使用XML帧解码器。如果我尝试在mxl消息解码器中扩展xml帧解码器,则会出现编译错误“xmlframedecoder中没有可用的默认构造函数”。