Is there an example of a very barebones Netty handler which simply gets whatever data is sent on the wire and writes it to a file?
I was thinking of something along the lines of this:
public class SimpleHandler extends SimpleChannelUpstreamHandler {
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
HttpRequest request = (HttpRequest) e.getMessage();
// get data from request and write to a file
}
Any ideas? Thanks for any thoughts
You could also just use this method to transfer the content of the ChannelBuffer to an OutputStream:
http://netty.io/docs/stable/api/org/jboss/netty/buffer/ChannelBuffer.html#readBytes(java.io.OutputStream,%20int)
So something like this: