Le 23/10/16 à 19:45, Murty Devarakonda a écrit : > I wrote a custom Protocol Encoder implementing the ProtocolEncoder interface > and I am using MINA 2.0.5 version. Mina 2.0.5 is 4 years old. 2.0.16 is currently being release, I strongly suggest you switch to this version taht will be out next week. > > But during testing, I am observing that the IoSession.write() call is not > hitting the ProtocolEncoder at all. What could be the reason for this? I > followed the creation of the ProtocolCodecFactory class correctly and my > ProtocolDecoder is working correctly on the request path. I am able to > store some attributes in the IoSession and am able to make use of them in my > request processing code. > > While sending back the response, I would like to see my breakpoint in the > debug session reaching the ProtocolEncoder and make the appropriate changes > to the response before writing out the response. > > Here is how my filter chain code is looking like: > > protected static void addFilters(Properties props, NioSocketAcceptor > acceptor, ProtocolCodecFactory factory) > { > DefaultIoFilterChainBuilder chain = acceptor.getFilterChain(); > String threadCountStr = props.getProperty("threads"); > int threadCount = threadCountStr == null ? s_threadCount : > Integer.parseInt(threadCountStr.trim()); > chain.addLast("protocol", new ProtocolCodecFilter(factory)); > if (threadCount > 0) { > ExecutorFilter filter = new ExecutorFilter(0, threadCount, > s_timeout, TimeUnit.SECONDS); > chain.addLast("limiter", filter); > } > } > > Any help with this would be greatly appreciated. I even tried logging the > MINA related log lines at the debug level to see if there is an exception > during response flow within MINA. But there is no exceptions too. The piece of code that you show does not tell a lot.
Hav you followed the http://mina.apache.org/mina-project/userguide/ch9-codec-filter/ch9-codec-filter.html page ? > > > > -- > View this message in context: > http://apache-mina.10907.n7.nabble.com/ProtocolEncoder-not-getting-used-in-the-response-path-tp51558.html > Sent from the Apache MINA User Forum mailing list archive at Nabble.com. -- Emmanuel Lecharny Symas.com directory.apache.org