That is correct. That said the `Adapter` classes usually do this for you. > On 23 Jul 2016, at 09:09, Victor Noël <[email protected]> wrote: > > Hi, > > I'm not netty expert, but from what I understand events (at least inbound > ones, I'm not so used to manipulating outbound ones, but I guess the > behaviour is mirrored) are not propagated except if you explicitly re-trigger > them (with context.fireEventType(ev)) in the Handler method for the event. > > > Le mercredi 20 juillet 2016 20:28:03 UTC+2, L_DisplayName a écrit : > I am implementing a custom FTP protocol using netty. However, to get started > I will have the server just send the length of the file, followed by the file > contents. To do this I am following the FileServer.java and the > FileServerHandler.java example that comes with netty. However, I have a few > questions in regards to how netty handles events intended to be handle by > just one handler when there are many handlers in the channel pipeline. For > example, consider FileServer.java and the FileServerHandler.java > > FileServer.java > p.addLast( > new StringEncoder(CharsetUtil.UTF_8), > new LineBasedFrameDecoder(8192), > new StringDecoder(CharsetUtil.UTF_8), > new ChunkedWriteHandler(), > new FileServerHandler()); > > In the example all server outbound events will propagate in the following > order through the channel pipeline > > FileServerHandler > ChunkedWriteHandler > StringEncoder > However, the server sends a string to the client requesting the name of the > file to send. My questions are: > > How does ChunkedWriterHandler handle the String since ChunkedWriterHandler is > expecting a chunkedInput specifically a ChunkedFile? > The NETTY API is not clear on this, is the String ignored by the > ChunkedWriterHandler and sent to the String encoder? If so, how is it > discarded? I looked at the ChunkedWriterHandler code and I did notice a > discard method, but I am unsure if this applies to this scenario: > > discard method inside ChunkedWriterHandler Object message = currentWrite.msg; > if (message instanceof ChunkedInput) { ChunkedInput in = (ChunkedInput) > message; try { //Do something; } else{ Closed Channel Exception } > > In addition, once the chunkedWriterHandler starts processing and sending > chunkedInput through the channel pipeline, how does the StringEncoder handle > chunkedInput? Does it ignore it (if so, how?) and just forwards it to the > next handler, however in this case there are no further handlers so does it > just writes the data to the socket or add it to a queue if flush was not > called after write? > > How does any Encoder write data to the socket? in many of the netty examples: > Telnet (StringEncoder), factorial (NumberEncoder), etc., the encoder just > writes the String or int to a ByteBuf, BUT WHERE IN THE ENCODER CODE IS THE > ByteBuf actually written and flushed to the socket/wire? > > > -- > You received this message because you are subscribed to the Google Groups > "Netty discussions" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/netty/715a1b70-a8d6-49b3-ad63-f701fd90d43e%40googlegroups.com > > <https://groups.google.com/d/msgid/netty/715a1b70-a8d6-49b3-ad63-f701fd90d43e%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>.
-- You received this message because you are subscribed to the Google Groups "Netty discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/netty/B1DD9B79-633C-4ED8-B670-E1808C6FE0A0%40googlemail.com. For more options, visit https://groups.google.com/d/optout.
