[jboss-svn-commits] JBL Code SVN: r15381 - in labs/jbossesb/trunk/product/rosetta/src/org/jboss: soa/esb/listeners/gateway and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Sep 26 08:24:38 EDT 2007


Author: tfennelly
Date: 2007-09-26 08:24:38 -0400 (Wed, 26 Sep 2007)
New Revision: 15381

Added:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpMarshaller.java
Modified:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpUnmarshaller.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListener.java
Log:
JBossRemotingGatewayListener default MessageComposer doesn't properly map invocation parameters to the ESB Message: http://jira.jboss.com/jira/browse/JBESB-1090

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpMarshaller.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpMarshaller.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpMarshaller.java	2007-09-26 12:24:38 UTC (rev 15381)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.internal.soa.esb.remoting;
+
+import org.jboss.remoting.marshal.http.HTTPMarshaller;
+import org.jboss.remoting.marshal.Marshaller;
+
+import java.io.OutputStream;
+import java.io.IOException;
+
+/**
+ * Extended version of the JBossRemoting HTTPMarshaller.
+ * <p/>
+ * Add support for byte[].
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class HttpMarshaller extends HTTPMarshaller {
+
+    public void write(Object object, OutputStream outputStream, int version) throws IOException {
+        if(object instanceof byte[]) {
+            outputStream.write((byte[])object);
+            outputStream.flush();
+        } else {
+            super.write(object, outputStream, version);
+        }
+    }
+
+    public Marshaller cloneMarshaller() throws CloneNotSupportedException {
+        return new HttpMarshaller();
+    }
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpMarshaller.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpUnmarshaller.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpUnmarshaller.java	2007-09-26 12:19:35 UTC (rev 15380)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpUnmarshaller.java	2007-09-26 12:24:38 UTC (rev 15381)
@@ -42,8 +42,6 @@
 
     static final long serialVersionUID = 1085086661310576768L;
 
-    public final static String DATATYPE = "http";
-
     protected final Logger log = Logger.getLogger(getClass());
 
     /**

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListener.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListener.java	2007-09-26 12:19:35 UTC (rev 15380)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JBossRemotingGatewayListener.java	2007-09-26 12:24:38 UTC (rev 15381)
@@ -55,6 +55,7 @@
 import org.jboss.soa.esb.services.registry.RegistryException;
 import org.jboss.soa.esb.services.registry.RegistryFactory;
 import org.jboss.internal.soa.esb.remoting.HttpUnmarshaller;
+import org.jboss.internal.soa.esb.remoting.HttpMarshaller;
 
 /**
  * JBoss Remoting listener implementation for receiving ESB unaware messages
@@ -143,12 +144,11 @@
     private boolean synchronous = true;
 
     /**
-     * Install our own unmarshaller for HTTP.  One that doesn't
-     * use a BufferedReader and strip away CRLF chars.
+     * Install our own marshaller/unmarshaller for HTTP.
      */
     static {
-        MarshalFactory.addMarshaller(HttpUnmarshaller.DATATYPE,
-                MarshalFactory.getMarshaller(HttpUnmarshaller.DATATYPE),
+        MarshalFactory.addMarshaller(HTTPMarshaller.DATATYPE,
+                new HttpMarshaller(),
                 new HttpUnmarshaller());
     }
 
@@ -438,15 +438,23 @@
         @SuppressWarnings("unchecked")
         protected void populateMessage(Message message, T invocationRequest) throws MessageDeliverException {
 
-            message.getBody().add(ActionUtils.POST_ACTION_DATA, invocationRequest.getParameter());
+            Object payload = invocationRequest.getParameter();
+            if(payload != null) {
+                message.getBody().add(ActionUtils.POST_ACTION_DATA, payload);
+            }
 
             // Copy the request properties onto the message...
             Map properties = invocationRequest.getRequestPayload();
             if (properties != null) {
-                Set<Map.Entry> propertyEntrySet = properties.entrySet();
-                for (Map.Entry entry : propertyEntrySet) {
-                    if (entry.getValue() != null) {
-                        message.getProperties().setProperty(entry.toString(), entry.getValue());
+                // Purposely not iterating over the Map.Entry Set because there's
+                // a bug in the Map impl used by JBossRemoting.  Not all the
+                // "values" are actually in the Map.Entry set.  Some of them are handled
+                // from within an overridden impl of the Map.get(Object) method.
+                Set names = properties.keySet();
+                for (Object name : names) {
+                    Object value = properties.get(name);
+                    if(value != null) {
+                        message.getProperties().setProperty(name.toString(), value);
                     }
                 }
             }




More information about the jboss-svn-commits mailing list