You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2010/07/05 17:37:01 UTC

svn commit: r960626 - /camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java

Author: davsclaus
Date: Mon Jul  5 15:37:01 2010
New Revision: 960626

URL: http://svn.apache.org/viewvc?rev=960626&view=rev
Log:
CAMEL-2907: NettyProducer supports async routing engine. CAMEL-2908: Added textline option to Netty.

Modified:
    camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java

Modified: camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java?rev=960626&r1=960625&r2=960626&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java (original)
+++ camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java Mon Jul  5 15:37:01 2010
@@ -71,6 +71,7 @@ public class NettyConfiguration implemen
     private boolean transferExchange;
     private boolean disconnectOnNoReply = true;
     private LoggingLevel noReplyLogLevel = LoggingLevel.WARN;
+    private boolean allowDefaultCodec = true;
 
     /**
      * Returns a copy of this configuration
@@ -117,22 +118,28 @@ public class NettyConfiguration implemen
 
         // add default encoders and decoders
         if (encoders.isEmpty() && decoders.isEmpty()) {
-            // are we textline or object?
-            if (isTextline()) {
-                Charset charset = getEncoding() != null ? Charset.forName(getEncoding()) : CharsetUtil.UTF_8;
-                encoders.add(new StringEncoder(charset));
-                decoders.add(new StringDecoder(charset));
-
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Using textline encoders and decoders with charset: " + charset);
+            if (allowDefaultCodec) {
+                // are we textline or object?
+                if (isTextline()) {
+                    Charset charset = getEncoding() != null ? Charset.forName(getEncoding()) : CharsetUtil.UTF_8;
+                    encoders.add(new StringEncoder(charset));
+                    decoders.add(new StringDecoder(charset));
+
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Using textline encoders and decoders with charset: " + charset);
+                    }
+                } else {
+                    // object serializable is then used
+                    encoders.add(new ObjectEncoder());
+                    decoders.add(new ObjectDecoder());
+
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Using object encoders and decoders");
+                    }
                 }
             } else {
-                // object serializable is then used
-                encoders.add(new ObjectEncoder());
-                decoders.add(new ObjectDecoder());
-
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug("Using object encoders and decoders");
+                    LOG.debug("No encoders and decoders will be used");
                 }
             }
         } else {
@@ -415,6 +422,14 @@ public class NettyConfiguration implemen
         this.noReplyLogLevel = noReplyLogLevel;
     }
 
+    public boolean isAllowDefaultCodec() {
+        return allowDefaultCodec;
+    }
+
+    public void setAllowDefaultCodec(boolean allowDefaultCodec) {
+        this.allowDefaultCodec = allowDefaultCodec;
+    }
+
     public String getAddress() {
         return host + ":" + port;
     }