You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Newcomb, Michael-P57487" <Mi...@gdc4s.com> on 2006/09/01 16:04:35 UTC

filters

So, I can transform the message before I call
nextFilter.write(message)...
And, if my filters decides *not* to send the message at all, do I just
not call nextFilter.write(message)?

Thanks,
Michael

Re: filters

Posted by Niklas Therning <ni...@trillian.se>.
Newcomb, Michael-P57487 wrote:
> So, I can transform the message before I call
> nextFilter.write(message)...
> And, if my filters decides *not* to send the message at all, do I just
> not call nextFilter.write(message)?

Yes, either that or you could call nextFilter.messageSent(message) if 
you want your IoHandler to believe that the message has been sent. In 
that case you should also set the WriteRequest.written property to true. 
Note that this applies to MINA 0.9. I'm not sure if it also works with 
MINA 0.8.

HTH
/Niklas

RE: filters

Posted by Benoit Hudzia <be...@gmail.com>.
Yes , that's what I use anyway in my filter. 
 
But I have another question related to filters: when inside a filter you
want to send back a message on the same session ( ex error message due to
malformed message etc..). Using session write in the filter    works
perfectly fine and the message is sent back . But when I do join() on
writefuture object  returned while doing session.write(myMessage) within the
filter  . The whole thing hang up , it looks like a deadlock and I didn't
have time yet to look within the code, but I would like to know if it's a
normal behaviour or a bug? 
 
Ex: 
 
 
<http://directory.apache.org/subprojects/mina/apidocs/org/apache/mina/common
/IoFilter.html#messageReceived%28org.apache.mina.common.IoFilter.NextFilter,
%20org.apache.mina.common.IoSession,%20java.lang.Object%29> messageReceived(
<http://directory.apache.org/subprojects/mina/apidocs/org/apache/mina/common
/IoFilter.NextFilter.html> IoFilter.NextFilter nextFilter,
<http://directory.apache.org/subprojects/mina/apidocs/org/apache/mina/common
/IoSession.html> IoSession session,
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html> Object
message)
{
WriteFuture wf= session.write(new myMessage());
wf.join();
}
 
 
Benoit Hudzia
Parallel Computing Research Group
School of Computer Science & Informatics
University College Dublin
Ireland
 
Tel: +353 1 716 2403
Fax: +353 1 269 7262
E-mail: benoit [dot] hudzia [at] ucd [dot] ie
Web: <http://benoit.hudzia.googlepages.com/>  Personnal Web Page,
<http://voidreflections.blogspot.com> Blog
 
-----Original Message-----
From: Newcomb, Michael-P57487 [mailto:Michael.Newcomb@gdc4s.com] 
Sent: 01 September 2006 15:05
To: mina-dev@directory.apache.org
Subject: filters
 
So, I can transform the message before I call
nextFilter.write(message)...
And, if my filters decides *not* to send the message at all, do I just
not call nextFilter.write(message)?
 
Thanks,
Michael