ProtocolCodecFilter is a nonfinal class, so if I understand your requirements correctly, you can override its filterWrite() method to invoke super.filterWrite() for 'normal' WriteRequests, and nextFilter.filterWrite() for FileInputStream WriteRequests to get the desired behaviour.
Barend On Sat, Aug 16, 2008 at 12:03 AM, Mitchell Berg <[EMAIL PROTECTED]> wrote: > Hi, > > I have a client/server app that sends both commands and files between the > client and the server. The commands use a certain custom protocol (i.e. a > header added to each message sent that allows each side to identify the type > of message). I would like to be able to send files over the > same connection. So my thought was to 1) modify the StreamWriteFilter so > that the appropriate header is added to each message sent - meaning the > protocol is added at the modified StreamWriterFilter > > > FileInputStream fis = *new* FileInputStream(fileToTransfer); > WriteFuture future = ioSession.write(fis); > future.join(); > and 2) to have all FileInputStream messages bypass the protocolCodecFilter. > > I just cannot figure out how to bypass the protocolCodecFilter for > FileInputStream objects?? > > Any ideas? > > Thanks, > Mitch >
