mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andre de C. Rodrigues" <andre.rodrigue...@gmail.com>
Subject Help creating a filter
Date Wed, 23 May 2007 19:13:51 GMT
I'm having some trouble creating a filter.

I need a filter that reads the content of the first received message
for authentication purposes. I'm trying to do something like the
EchoProtocolHandler does for reading the message:

        ByteBuffer rb = ( ByteBuffer ) message;
        // Write the received data back to remote peer
        ByteBuffer wb = ByteBuffer.allocate( rb.remaining() );
        wb.put( rb );

Now, this code works fine in a handler class (extends
IoHandlerAdapter)... and in my conception, it should work when placed
in the messageReceived method of a filter (extends LoggingFilter)
aswell. The thing is that it doesn't.

I'm having an exception thrown at me because of the        ByteBuffer
rb = ( ByteBuffer ) message;      line :

org.apache.mina.filter.SSLFilter$SSLFilterMessage cannot be cast to
	at org.apache.mina.example.echoserver.LogbackFilter.messageReceived(LogbackFilter.java:66)

Well, to put things short, the line ByteBuffer rb = ( ByteBuffer )
message; doesn't seem to work in a filter. Does anybody know why this
exception is being thrown and what I can do to fix/work around it?

Thanks in advance,

View raw message