directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r330749 - /directory/network/trunk/src/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
Date Fri, 04 Nov 2005 08:23:53 GMT
Author: trustin
Date: Fri Nov  4 00:23:50 2005
New Revision: 330749

URL: http://svn.apache.org/viewcvs?rev=330749&view=rev
Log:
Made ProtocolCodecFilter to bypass ByteBuffers while encoding and unknown objects while decoding.

Modified:
    directory/network/trunk/src/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java

Modified: directory/network/trunk/src/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java?rev=330749&r1=330748&r2=330749&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
Fri Nov  4 00:23:50 2005
@@ -30,6 +30,12 @@
     
     public void messageReceived( NextFilter nextFilter, IoSession session, Object message
) throws Exception
     {
+        if( !( message instanceof ByteBuffer ) )
+        {
+            nextFilter.messageReceived( session, message );
+            return;
+        }
+
         ByteBuffer in = ( ByteBuffer ) message;
         ProtocolDecoder decoder = getDecoder( session );
         SimpleProtocolDecoderOutput decoderOut = getDecoderOut( session );
@@ -83,6 +89,12 @@
 
     public void messageSent( NextFilter nextFilter, IoSession session, Object message ) throws
Exception
     {
+        if( ! ( message instanceof MessageByteBuffer ) )
+        {
+            nextFilter.messageSent( session, message );
+            return;
+        }
+
         MessageByteBuffer buf = ( MessageByteBuffer ) message;
         try
         {
@@ -96,13 +108,20 @@
     
     public void filterWrite( NextFilter nextFilter, IoSession session, WriteRequest writeRequest
) throws Exception
     {
+        Object message = writeRequest.getMessage();
+        if( message instanceof ByteBuffer )
+        {
+            nextFilter.filterWrite( session, writeRequest );
+            return;
+        }
+
         ProtocolEncoder encoder = getEncoder( session );
         ProtocolEncoderOutputImpl encoderOut = getEncoderOut( session );
         encoderOut.nextFilter = nextFilter;
         
         try
         {
-            encoder.encode( session, writeRequest.getMessage(), encoderOut );
+            encoder.encode( session, message, encoderOut );
         }
         catch( Throwable t )
         {



Mime
View raw message