In my application, I add special decision inside ProtocolEncoder /
ProtocolDecoder to bypass certain data type.

I don't know if override ProtocolCodecFilter.filterWrite() is a better
way. If it is, why not add a template method inside it thus child class
can easily write its own implementation
to bypass special data packet.

BR
anderson

-----Original Message-----
From: W.B. Garvelink [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 16, 2008 9:35 PM
To: [email protected]
Subject: Re: How to ByPass ProtocolCodecFilter for FileInputStream
Object

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
>

Reply via email to