Thanks for the input again. Does anyone know if there is a book in the works for Mina?
Thanks, S.D. --- [EMAIL PROTECTED] wrote: > Hi, > > A MINA filter is not exactly like a servlet filter > because a servlet filter > only processes data as it is received. > > MINA filters process events - such as data coming > from the network, or a > request to write data. They are arranged in a filter > chain. However the key > thing to know is that events are not all processed > in the same order by the > filter chain. If you view the filter chain as going > from top to bottom, > reads are processed from top to bottom but write > requests are processed > bottom to top. It's a layered model. > > To see why this is useful, consider an application > where you want to > encrypt your data, and also support encoding and > decoding the bytes into > Java objects. You would have two filters: > encryptor/decryptor then codec. > For reads you want to decrypt first then decode, and > for writes you want to > encode then encrypt. The layered model makes this > easy. > > For your application, it may be simpler to use a > codec to handle the > encoding/decoding so that your handler only has to > deal with Java objects. > See org.apache.mina.filter.codec.ProtocolCodecFilter > for details. > > Also unless your codec is extremely simple, you > should consider using the > thread pool filter to improve throughput. > > Robert > > > |---------+----------------------------> > | | Samuel Doyle | > | | <[EMAIL PROTECTED]| > | | om> | > | | | > | | 08/03/2006 21:49 | > | | Please respond to| > | | mina-dev | > | | | > |---------+----------------------------> > > >--------------------------------------------------------------------------------------------------------------------------------| > | > > | > | To: [email protected] > > | > | cc: > > | > | Subject: Using filters in Mina > > | > > >--------------------------------------------------------------------------------------------------------------------------------| > > > > > Hi, > > I'm not very familiar with filters myself and > started > looking into them. I see much documentation on them > for use in Servlets but how does it vary in Mina? > I've > basically designed a proxy server using Mina to act > as > a proxy for routing requests between two very > different systems. The mechanism I use is in > attaching specific objects to the sessions and would > use these in encoding and decoding of the packet > data > in the messageReceived methods of my handlers. I was > wondering if this is something that would be better > implemented as a filter? If so what is the best > approach? > > Thanks, S.D. > > > > > > This communication is for informational purposes > only. It is not intended > as an offer or solicitation for the purchase or sale > of any financial > instrument or as an official confirmation of any > transaction. All market prices, > data and other information are not warranted as to > completeness or accuracy and > are subject to change without notice. Any comments > or statements made herein > do not necessarily reflect those of JPMorgan Chase & > Co., its subsidiaries > and affiliates. >
