[jboss-svn-commits] JBL Code SVN: r29056 - in labs/jbossesb/workspace/tfennelly/httpg2: product/rosetta/src/org/jboss/internal/soa/esb/listeners/war and 8 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Aug 25 13:00:27 EDT 2009


Author: tfennelly
Date: 2009-08-25 13:00:25 -0400 (Tue, 25 Aug 2009)
New Revision: 29056

Added:
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpMessageComposer.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpRequestInfo.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpRequestWrapper.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/http-exception-mappings.properties
   labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyActionException.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyExceptionAction.java
Removed:
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayServlet.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpRequestWrapper.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/sales-jboss-web.xml
   labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/sales-web.xml
Modified:
   labs/jbossesb/workspace/tfennelly/httpg2/product/etc/schemas/xml/jbossesb-1.2.0.xsd
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchive.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebGatewayDeploymentFactory.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/HttpGatewayMapper.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpDispatchServlet.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayListener.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/LegacyHttpMessageComposer.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/build.xml
   labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/jboss-esb.xml
   labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/readme.txt
   labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java
   labs/jbossesb/workspace/tfennelly/httpg2/qa/quickstarts/src/org/jboss/soa/esb/quickstart/test/HttpGatewayTest.java
Log:
Exception mapping functionality

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/etc/schemas/xml/jbossesb-1.2.0.xsd
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/etc/schemas/xml/jbossesb-1.2.0.xsd	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/etc/schemas/xml/jbossesb-1.2.0.xsd	2009-08-25 17:00:25 UTC (rev 29056)
@@ -1797,6 +1797,7 @@
                                 </xsd:attribute>
                             </xsd:complexType>
                         </xsd:element>
+                        <xsd:element name="exception" type="jesb:httpExceptionMappings" minOccurs="0" maxOccurs="1" />
                     </xsd:sequence>
                 </xsd:extension>
 			</xsd:complexContent>
@@ -1812,6 +1813,9 @@
 		<xsd:complexType>
 			<xsd:complexContent>
 				<xsd:extension base="jesb:gateway-only-listener">
+                    <xsd:choice>
+                        <xsd:element name="exception" type="jesb:httpExceptionMappings" minOccurs="0" maxOccurs="1" />
+                    </xsd:choice>
                     <xsd:attribute name="urlPattern" type="xsd:string" use="optional">
                         <xsd:annotation>
                             <xsd:documentation xml:lang="en">
@@ -1836,6 +1840,23 @@
             <xsd:enumeration value="BYTES"/>
         </xsd:restriction>
     </xsd:simpleType>
+    <xsd:complexType name="httpExceptionMappings">
+        <xsd:sequence>
+            <xsd:element name="mapping" minOccurs="0" maxOccurs="unbounded">
+                <xsd:complexType>
+                    <xsd:attribute name="class" type="xsd:string" use="required" />
+                    <xsd:attribute name="status" type="xsd:integer" use="required" />
+                </xsd:complexType>
+            </xsd:element>
+        </xsd:sequence>
+        <xsd:attribute name="mappingsFile" type="xsd:string" use="optional">
+            <xsd:annotation>
+                <xsd:documentation xml:lang="en">
+                    Path to a .properties file containing a list of Exception to HTTP Status code mappings.
+                </xsd:documentation>
+            </xsd:annotation>
+        </xsd:attribute>
+    </xsd:complexType>
 
 	<!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
 		Groovy Gateway Type Implementations.

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -19,8 +19,7 @@
  */
 package org.jboss.internal.soa.esb.listeners.war;
 
-import org.jboss.soa.esb.listeners.config.DeploymentResourceLocator;
-import org.jboss.soa.esb.listeners.gateway.HttpGatewayServlet;
+import org.jboss.soa.esb.listeners.gateway.http.HttpGatewayServlet;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.ConfigurationException;
@@ -38,14 +37,6 @@
     public static final String AUTH_METHOD = "authMethod";
     public static final String AUTH_DOMAIN = "authDomain";
 
-    public void setBusName(String busName) {
-        // Not relevant to this factory!
-    }
-
-    public void setDeploymentResourceLocator(DeploymentResourceLocator resourceLocator) {
-        // Not relevant to this factory!
-    }
-
     public void updateDeployment(ConfigTree webEndpointConfig, WebDeploymentArchive webDeployment) throws ConfigurationException {
         String servletName = webEndpointConfig.getRequiredAttribute("name");
         Servlet servlet = new Servlet(servletName, HttpGatewayServlet.class.getName(), webDeployment.getWebModel());

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchive.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchive.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchive.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -64,8 +64,6 @@
 
             // Add the jboss-web.xml...
             addJBossWebXML();
-
-            // TODO: Add jboss-web.xml
         } finally {
             // Mark as finalized...
             archiveFinalized = true;

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebGatewayDeploymentFactory.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebGatewayDeploymentFactory.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/listeners/war/WebGatewayDeploymentFactory.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -33,18 +33,6 @@
 public interface WebGatewayDeploymentFactory {
 
     /**
-     * Set the name of the bus configuration associated with the deployment.
-     * @param busName The bus name.
-     */
-    public void setBusName(String busName);
-
-    /**
-     * Set the {@link org.jboss.soa.esb.listeners.config.DeploymentResourceLocator} for the deployment.
-     * @param resourceLocator Deployment resource locator.
-     */
-    public void setDeploymentResourceLocator(DeploymentResourceLocator resourceLocator);
-
-    /**
      * Get the deployment archives to be deployed.
      * @param webEndpointConfig The web endpoint configuration.
      * @param webDeployment The web deployment archive to be updated.

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -26,6 +26,7 @@
 import org.jboss.soa.esb.common.ModulePropertyManager;
 import org.jboss.soa.esb.listeners.message.MessageDeliverException;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
 
 import com.arjuna.common.util.propertyservice.PropertyManager;
 
@@ -38,6 +39,7 @@
 {
     private static final long DEFAULT_TIMEOUT = 30000L ;
     private static final long TIMEOUT ;
+    private static final boolean BYPASS ;
     private static final Logger LOGGER = Logger.getLogger(RequestResponseBaseWebService.class) ;
     
     protected RequestResponseBaseWebService(final String category, final String name, final String requestLocation, final String responseLocation, final String action)
@@ -50,7 +52,13 @@
     protected Message deliverMessage(final Message request)
             throws Exception
     {
-        return serviceInvoker.deliverSync(request, TIMEOUT);
+        if(!BYPASS) {
+            return serviceInvoker.deliverSync(request, TIMEOUT);
+        } else {
+            Message newMessage = MessageFactory.getInstance().getMessage();
+            newMessage.getBody().add("<response></response>");
+            return newMessage;
+        }
     }
     
     static
@@ -70,5 +78,7 @@
             }
         }
         TIMEOUT = timeout ;
+
+        BYPASS = (propertyManager.getProperty("BYPASS") != null);
     }
 }

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -270,7 +270,16 @@
          super.init(di);
 
          // Deploy web gateways...
-         deployWebGateways(deployment, model, di);
+          final ClassLoader origCL = Thread.currentThread().getContextClassLoader() ;
+          try
+          {
+              Thread.currentThread().setContextClassLoader(di.localCl) ;
+              deployWebGateways(deployment, model, di);
+          }
+          finally
+          {
+              Thread.currentThread().setContextClassLoader(origCL) ;
+          }
       }
       catch (Exception e)
       {
@@ -489,16 +498,7 @@
         WebDeploymentArchive webDeployment = new WebDeploymentArchive(getESBWarFileName(di));
 
         // Add the EBWS components...
-        final ClassLoader origCL = Thread.currentThread().getContextClassLoader() ;
-        try
-        {
-            Thread.currentThread().setContextClassLoader(di.localCl) ;
-            createWebserviceWars(di, model, deploymentName, publishers, webDeployment);
-        }
-        finally
-        {
-            Thread.currentThread().setContextClassLoader(origCL) ;
-        }
+        createWebserviceWars(di, model, deploymentName, publishers, webDeployment);
 
         // Add the webDeployment...
         for(Map.Entry<String, List<ConfigTree>> listenerGroup : listenerGroupEntries) {

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/HttpGatewayMapper.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/HttpGatewayMapper.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/HttpGatewayMapper.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -1,18 +1,24 @@
 package org.jboss.soa.esb.listeners.config.mappers120;
 
 import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.util.ClassUtil;
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.gateway.HttpGatewayServlet;
+import org.jboss.soa.esb.listeners.gateway.http.HttpGatewayServlet;
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.PropertyDocument.Property;
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.HttpBusDocument.HttpBus;
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.HttpGatewayDocument.HttpGateway;
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.HttpProviderDocument.HttpProvider;
 import org.jboss.soa.esb.listeners.config.xbeanmodel120.PayloadAs;
+import org.jboss.soa.esb.listeners.config.xbeanmodel120.HttpExceptionMappings;
 import org.jboss.internal.soa.esb.listeners.war.HttpGatewayDeploymentFactory;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
 import org.w3c.dom.Element;
+import org.apache.log4j.Logger;
 
-import java.util.List;
+import java.util.*;
+import java.io.InputStream;
+import java.io.IOException;
 
 /**
  * Http gateway mapper.
@@ -20,6 +26,8 @@
  */
 public class HttpGatewayMapper {
 
+    private static final Logger logger = Logger.getLogger(HttpGatewayMapper.class);
+
     /**
      * Perform the Http listener mapping.
      * @param root The "ConfigTree" configuration root node.
@@ -102,9 +110,15 @@
             if(transportGuarantee != null) {
                 listenerNode.setAttribute(HttpGatewayDeploymentFactory.TRANSPORT_GUARANTEE, transportGuarantee.toString());
             }
+
+            // Exception status mappings...
+            mapExceptionStatusMappings(listenerNode, provider, listener);
         } else {
             // Use the "default" http bus....
             mapStandardSettings(listenerNode, urlPattern, payloadAs, listener.getPropertyList());
+
+            // Exception status mappings...
+            mapExceptionStatusMappings(listenerNode, (HttpProvider) model.getProvider(HttpProvider.class), listener);
         }
 
         return listenerNode;
@@ -123,4 +137,98 @@
             listenerNode.setAttribute(HttpGatewayServlet.PAYLOAD_AS, payloadAs.toString());
         }
     }
+
+    private static void mapExceptionStatusMappings(Element listenerNode, HttpProvider provider, HttpGateway listener) throws ConfigurationException {
+        StringBuilder exceptionMappingsAttrBuilder = new StringBuilder();
+
+        if(provider != null) {
+            HttpExceptionMappings providerExceptionConfig = provider.getException();
+            if(providerExceptionConfig != null) {
+                buildExceptionMappingCSV(exceptionMappingsAttrBuilder, providerExceptionConfig);
+            }
+        }
+
+        if(listener != null) {
+            HttpExceptionMappings listenerExceptionConfig = listener.getException();
+            if(listenerExceptionConfig != null) {
+                buildExceptionMappingCSV(exceptionMappingsAttrBuilder, listenerExceptionConfig);
+            }
+        }
+
+        if(exceptionMappingsAttrBuilder.length() > 0) {
+            listenerNode.setAttribute(org.jboss.soa.esb.listeners.gateway.http.HttpGatewayServlet.EXCEPTION_MAPPINGS, exceptionMappingsAttrBuilder.toString());
+        }
+    }
+
+    private static void buildExceptionMappingCSV(StringBuilder exceptionMappingsAttrBuilder, HttpExceptionMappings exceptionConfig) throws ConfigurationException {
+        // The mappings file is a .properties file containing exception-to-status-code mappings...
+        String mappingsFile = exceptionConfig.getMappingsFile();
+        if(mappingsFile != null) {
+            Properties mappings = loadExceptionMappings(mappingsFile);
+            Set<Map.Entry<Object, Object>> entries = mappings.entrySet();
+
+            for(Map.Entry<Object, Object> entry : entries) {
+                exceptionMappingsAttrBuilder.append(entry.getKey().toString().trim());
+                exceptionMappingsAttrBuilder.append("=");
+                exceptionMappingsAttrBuilder.append(entry.getValue().toString().trim());
+                exceptionMappingsAttrBuilder.append(",");
+            }
+        }
+
+        // We add the exception mappings as a CSV list of exception class name and status
+        // code key value pairs...
+        List<HttpExceptionMappings.Mapping> mappings = exceptionConfig.getMappingList();
+        if(mappings != null && !mappings.isEmpty()) {
+            for(HttpExceptionMappings.Mapping mapping : mappings) {
+                exceptionMappingsAttrBuilder.append(mapping.getClass1().trim());
+                exceptionMappingsAttrBuilder.append("=");
+                exceptionMappingsAttrBuilder.append(mapping.getStatus());
+                exceptionMappingsAttrBuilder.append(",");
+            }
+        }
+    }
+
+    public static Map<String, Integer> decodeExceptionMappingsCSV(String exceptionMappingsCSV) throws ConfigurationException {
+        AssertArgument.isNotNullAndNotEmpty(exceptionMappingsCSV, "exceptionMappingsCSV");
+
+        Map<String, Integer> mappings = new HashMap<String, Integer>();
+        String[] mappingDecls = exceptionMappingsCSV.split(",");
+
+        for(String mappingDecl : mappingDecls) {
+            String[] mappingTokens = mappingDecl.split("=");
+            if(mappingTokens.length != 2) {
+                throw new ConfigurationException("Invalid Exception Status Mapping mapping declaration '" + mappingDecl + "'.  Expected a '<exception>=<status>' Key Value Pair.");
+            }
+            try {
+                mappings.put(mappingTokens[0], Integer.valueOf(mappingTokens[1]));
+            } catch(NumberFormatException e) {
+                throw new ConfigurationException("Invalid Exception Status Mapping mapping declaration '" + mappingDecl + "'.  Status code value '" + mappingTokens[1] + "' not a valid integer.");
+            }
+        }
+
+        return mappings;
+    }
+
+    private static Properties loadExceptionMappings(String mappingsFile) throws ConfigurationException {
+        Properties mappings = new Properties();
+        InputStream stream = ClassUtil.getResourceAsStream(mappingsFile, HttpGatewayMapper.class);
+
+        if(stream == null) {
+            throw new ConfigurationException("Failed to find Exception to HTTP Status code mappings file '" + mappingsFile + "' on classpath.");
+        }
+
+        try {
+            mappings.load(stream);
+        } catch (IOException e) {
+            throw new ConfigurationException("Error reading Exception to HTTP Status code mappings file '" + mappingsFile + "'.", e);
+        } finally {
+            try {
+                stream.close();
+            } catch (IOException e) {
+                logger.debug("Error closing Exception to HTTP Status code mappings file '" + mappingsFile + "'.", e);
+            }
+        }
+
+        return mappings;
+    }
 }
\ No newline at end of file

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/XMLBeansModel.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -190,6 +190,23 @@
         throw new IllegalStateException("No Provider instance found for the supplied Bus config instance.  This should not be possible if the Bus instance was provided by this configuration.  Where has this Bus instance come from?");
     }
 
+    /**
+     * Get the &lt;provider&gt; configuration containing the supplied Bus configuration instance.
+     * @param providerType The Bus Provider type is being sought.
+     * @return The Provider configuration instance.
+     */
+    public Provider getProvider(Class<? extends BusProvider> providerType) {
+        List<Provider> providers = jbossesb.getProviders().getProviderList();
+
+        for(Provider provider : providers) {
+            if(providerType.isAssignableFrom(provider.getClass())) {
+                return provider;
+            }
+        }
+
+        return null;
+    }
+
     public Schedule getSchedule(final String id) {
         if((id == null) || (jbossesb.getProviders() == null)) {
             return null;

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpDispatchServlet.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpDispatchServlet.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpDispatchServlet.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -30,7 +30,7 @@
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.couriers.FaultMessageException;
 import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.gateway.http.HttpRequestWrapper;
 import org.jboss.soa.esb.listeners.message.UncomposedMessageDeliveryAdapter;
 import org.jboss.soa.esb.message.Message;
 
@@ -119,7 +119,7 @@
 			return;
 		}
 		
-		HttpRequestWrapper wrapper = new HttpRequestWrapper(request, response, null);
+		org.jboss.soa.esb.listeners.gateway.http.HttpRequestWrapper wrapper = new HttpRequestWrapper(request, response, null);
        
 		try {
 			if (synchronous) {

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayListener.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayListener.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -28,7 +28,6 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.management.InstanceNotFoundException;
 import javax.management.ObjectName;
 import javax.naming.Context;
 import javax.naming.InitialContext;
@@ -46,7 +45,6 @@
 import org.apache.log4j.Logger;
 import org.jboss.mx.util.MBeanServerLocator;
 import org.jboss.naming.Util;
-import org.jboss.remoting.ServerInvoker;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.addressing.EPR;
 import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
@@ -414,7 +412,7 @@
 			throws ConfigurationException {
 		return UncomposedMessageDeliveryAdapter.getGatewayDeliveryAdapter(
 				getConfig(),
-				new LegacyHttpMessageComposer<HttpRequestWrapper>());
+				new LegacyHttpMessageComposer<org.jboss.soa.esb.listeners.gateway.http.HttpRequestWrapper>());
 	}
 
 	/**Initialize the StandardContext.By default it will uses 

Deleted: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayServlet.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayServlet.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayServlet.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -1,141 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, 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-2008, JBoss Inc.
- */
-package org.jboss.soa.esb.listeners.gateway;
-
-import org.jboss.soa.esb.Service;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.couriers.FaultMessageException;
-import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.message.MessageDeliverException;
-import org.jboss.soa.esb.listeners.message.MessageComposer;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.config.Configuration;
-import org.jboss.soa.esb.client.ServiceInvoker;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
-import javax.servlet.ServletConfig;
-import java.io.IOException;
-import java.util.Enumeration;
-
-/**
- * Http Gateway Servlet.
- * <p/>
- * An instance of this class gets configured for each http-listener urlPattern.
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @see org.jboss.internal.soa.esb.listeners.war.HttpGatewayDeploymentFactory
- */
-public class HttpGatewayServlet extends HttpServlet {
-
-    private Service service;
-    private ServiceInvoker serviceInvoker;
-    private MessageComposer<HttpRequestWrapper> messageComposer;
-    private String mep;
-    private long blockingTimeout;
-    public static final String PAYLOAD_AS = "payloadAs";
-
-    public void init(ServletConfig config) throws ServletException {
-        service = new Service(config.getInitParameter(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG), config.getInitParameter(ListenerTagNames.TARGET_SERVICE_NAME_TAG));
-        try {
-            serviceInvoker = new ServiceInvoker(service);
-        } catch (MessageDeliverException e) {
-            throw new ServletException("Unable to create ServiceInvoker for Service '" + service + "'.", e);
-        }
-
-        ConfigTree configTree = toConfigTree(config);
-        try {
-            messageComposer = MessageComposer.Factory.getInstance(configTree.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_CLASS_TAG, HttpMessageComposer.class.getName()), configTree);
-        } catch (ConfigurationException e) {
-            throw new ServletException("Failed to create message composer.", e);
-        } catch (MessageDeliverException e) {
-            throw new ServletException("Failed to create message composer.", e);
-        }
-
-        blockingTimeout = configTree.getLongAttribute("synchronousTimeout", 30000);
-        mep = Configuration.getMep(configTree);
-    }
-
-    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        HttpRequestWrapper wrapper = new HttpRequestWrapper(req, resp, service);
-
-        Message inMessage;
-        try {
-            inMessage = messageComposer.compose(wrapper);
-        } catch (MessageDeliverException e) {
-            throw new ServletException("Failed to create message.", e);
-        }
-
-        Message outMessage;
-        try {
-            // Dispatch the message to the action pipeline, using the service mep to decide
-            // whether to invoke sync or async...
-            if(mep.equals(ListenerTagNames.MEP_REQUEST_RESPONSE)) {
-                outMessage = serviceInvoker.deliverSync(inMessage, blockingTimeout);
-
-                // Set the mep as a header on the response...
-                resp.setHeader("mep", mep);
-            } else {
-                serviceInvoker.deliverAsync(inMessage);
-                resp.setContentLength(0);
-                resp.setStatus(HttpServletResponse.SC_OK);
-
-                // Set the mep as a header on the response...
-                resp.setHeader("mep", mep);
-
-                return;
-            }
-        } catch (MessageDeliverException e) {
-            throw new ServletException("Failed to deliver message.", e);
-        } catch (RegistryException e) {
-            throw new ServletException("Failed to deliver message.", e);
-        } catch (FaultMessageException e) {
-            throw new ServletException("Failed to deliver message.", e);
-        }
-
-        if(outMessage != null) {
-            try {
-                messageComposer.decompose(outMessage, wrapper);
-            } catch (MessageDeliverException e) {
-                throw new ServletException("Failed to decompose response message.", e);
-            }
-        } else {
-            resp.setContentLength(0);
-            resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
-            return;
-        }
-    }
-
-    private ConfigTree toConfigTree(ServletConfig config) {
-        ConfigTree configTree = new ConfigTree("config");
-        Enumeration configNames = config.getInitParameterNames();
-
-        while(configNames.hasMoreElements()) {
-            String name = (String) configNames.nextElement();
-            configTree.setAttribute(name, config.getInitParameter(name));
-        }        
-
-        return configTree;
-    }
-}

Deleted: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -1,300 +0,0 @@
-/*
- * 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.soa.esb.listeners.gateway;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.*;
-import java.util.regex.Pattern;
-import java.nio.charset.Charset;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.jboss.soa.esb.actions.ActionUtils;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.message.AbstractMessageComposer;
-import org.jboss.soa.esb.listeners.message.MessageDeliverException;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.message.Body;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.MessagePayloadProxy;
-import org.jboss.soa.esb.message.MessagePayloadProxy.NullPayloadHandling;
-import org.jboss.soa.esb.message.body.content.BytesBody;
-import org.jboss.soa.esb.common.ModulePropertyManager;
-
-/**
- * Http Message Composer.
- * <p/>
- * This class is used to compose the HttpServletRquest
- * to ESB aware message and decompse the ESB aware message to HttpServletRespones
- * <p>
- * This class will put the http request header and other requst information in ESB message properties with the key "RequestInfoMap".
- * <p>
- * If the request is the submitted from html form(with the <code>Content-Type: application/x-www-form-urlencoded</code>), HttpServletRequest.getParameterMap() result)
- * will be put in ESB message properties. The key for it is "RequestParamterMap". It put the the byte array read from request inputstream in message payload.
- * <p>
- * In decompose process, the header map in message properties will be added
- * in HttpServletResponse. The value for "ReponseStatus" store in ESB message properties will
- * put in the http response. The message payload byte[] or String object will be wrote to HttpServletResponse.
- * If the object in message payload is not byte[],it will throw exception when the ESB message
- * is decomposed
- *
- * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
- */
-public class HttpMessageComposer<T extends HttpRequestWrapper> extends AbstractMessageComposer<T> {
-
-    private static final Logger logger = Logger.getLogger(HttpMessageComposer.class);
-
-    /** Request parameter map key in esb message properties */
-	public static final String HTTP_REQUEST_PARAMETER_MAP = "RequestParameterMap";
-
-	/** Request information map key in esb message properties */
-	public static final String HTTP_REQUEST_INFO_MAP = "RequestInfoMap";
-
-	/** Reponse header map key in esb message properties */
-	public static final String HTTP_RESPONSE_HEADER_MAP = "ResponseHeaderMap";
-
-	/** Response status key in esb message properties */
-	public static final String HTTP_RESPONSE_STATUS = "ReponseStatus";
-
-	/** Message payload proxy */
-	private MessagePayloadProxy payloadProxy;
-
-    private String payloadAs;
-    private Pattern[] textMimePatterns;
-
-    /*
-	 * Method for configue the payload proxy
-	 */
-	public void setConfiguration(ConfigTree config) {
-		super.setConfiguration(config);
-		payloadProxy = new MessagePayloadProxy(config, new String[] {
-				ActionUtils.POST_ACTION_DATA, Body.DEFAULT_LOCATION,
-				BytesBody.BYTES_LOCATION },
-				new String[] { ActionUtils.POST_ACTION_DATA });
-		payloadProxy.setNullSetPayloadHandling(NullPayloadHandling.LOG);
-
-        payloadAs = config.getAttribute("payloadAs");
-        if(payloadAs == null) {
-            // Get the globally configured text mime types...
-            String[] textTypes = ModulePropertyManager.getPropertyManager("core").getProperty("org.jboss.soa.esb.mime.text.types", "text/*;application/xml;application/*-xml").split(";");
-            textMimePatterns = new Pattern[textTypes.length];
-            for(int i = 0; i < textMimePatterns.length; i++) {
-                textMimePatterns[i] = Pattern.compile(textTypes[i].trim().replace("*", ".*"));
-            }
-        }
-    }
-
-	protected MessagePayloadProxy getPayloadProxy() {
-		return payloadProxy;
-	}
-
-	/*
-	 *Method for populating the ESB aware message from a HttpServletRequest
-	 */
-	@SuppressWarnings("unchecked")
-	protected void populateMessage(Message message, T requestWrapper) throws MessageDeliverException {
-		HttpServletRequest request = requestWrapper.getRequest();
-		Map paraMap = request.getParameterMap();
-		byte[] bodyBytes = null;
-
-        try {
-			bodyBytes = StreamUtils.readStream(request.getInputStream());
-		} catch (IOException e) {
-			throw new MessageDeliverException("Failed to read body data from http request", e);
-		}
-
-        String characterEncoding = request.getCharacterEncoding();
-        Charset charset;
-        if(characterEncoding == null) {
-            charset = Charset.defaultCharset();
-        } else {
-            charset = Charset.forName(characterEncoding);
-        }
-
-        if(payloadAs == null) {
-            String contentType = request.getContentType();
-
-            if(contentType != null && isTextMimetype(contentType)) {
-                try {
-                    payloadProxy.setPayload(message, new String(bodyBytes, charset.name()));
-                } catch (UnsupportedEncodingException e) {
-                    throw new MessageDeliverException("Invalid Character encoding '" + characterEncoding + "' set on request.", e);
-                }
-            } else {
-                payloadProxy.setPayload(message, bodyBytes);
-            }
-        } else if(payloadAs.equals("STRING")) {
-            try {
-                payloadProxy.setPayload(message, new String(bodyBytes, charset.name()));
-            } catch (UnsupportedEncodingException e) {
-                throw new MessageDeliverException("Invalid Character encoding '" + characterEncoding + "' set on request.", e);
-            }
-        } else {
-            payloadProxy.setPayload(message, bodyBytes);
-        }
-
-        //Set http request info
-		message.getProperties().setProperty(HTTP_REQUEST_INFO_MAP, getRequestInfo(request));
-		if (paraMap != null && !paraMap.isEmpty()) {
-		   message.getProperties().setProperty(this.HTTP_REQUEST_PARAMETER_MAP, paraMap);
-		}
-	}
-
-    private boolean isTextMimetype(String contentType) {
-        for(int i = 0; i < textMimePatterns.length; i++) {
-            if(textMimePatterns[i].matcher(contentType).matches()) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-
-    /*
-    * Method for decompsing a esb message to a HttpServletResponse
-    */
-	@SuppressWarnings("unchecked")
-	public Object decompose(Message message, T requestWrapper) throws MessageDeliverException {
-        HttpServletRequest request = requestWrapper.getRequest();
-        HttpServletResponse  response = requestWrapper.getResponse();
-        Map<String, String> headers;
-        Integer status;
-
-        try {
-            headers = (Map<String, String>) message.getProperties().getProperty(HTTP_RESPONSE_HEADER_MAP);
-        } catch(ClassCastException e) {
-            response.setStatus(HttpServletResponse.SC_BAD_GATEWAY);
-            logger.debug("'" + HTTP_RESPONSE_HEADER_MAP + "' must be of type " + Map.class.getName());
-            return null;
-        }
-
-        try {
-            status = (Integer) message.getProperties().getProperty(HTTP_RESPONSE_STATUS);
-        } catch(ClassCastException e) {
-            response.setStatus(HttpServletResponse.SC_BAD_GATEWAY);
-            logger.debug("'" + HTTP_RESPONSE_STATUS + "' must be of type Integer.");
-            return null;
-        }
-
-        if (headers != null) {
-            Set<Map.Entry<String, String>> entries = headers.entrySet();
-            for(Map.Entry<String, String> entry : entries) {
-                String headerName = entry.getKey();
-                if(headerName.equals("Content-Type")) {
-                    response.setContentType(entry.getValue());
-                } else {
-                    response.setHeader(entry.getKey(), entry.getValue());
-                }
-            }
-        }
-
-		Object obj = payloadProxy.getPayload(message);
-		try {
-            byte[] outBytes;
-
-            if (obj instanceof String) {
-                String encoding = request.getCharacterEncoding();
-                if(encoding == null) {
-                    encoding = "UTF-8";
-                }
-                outBytes = ((String) obj).getBytes(encoding);
-            } else if (obj instanceof byte[]) {
-				outBytes = (byte[]) obj;
-            } else if (obj == null) {
-                response.setContentLength(0);
-                response.setStatus(HttpServletResponse.SC_NO_CONTENT);
-                logger.debug("Expected a response payload from '" + ListenerTagNames.MEP_REQUEST_RESPONSE + "' service '" + requestWrapper.getService() + "', but received none.");
-                return null;
-            } else {
-                response.setContentLength(0);
-                response.setStatus(HttpServletResponse.SC_BAD_GATEWAY);
-                logger.debug("Unsupport HTTP response payload type " + obj.getClass().getName() + " from service '" + requestWrapper.getService() + "'.  Only supports java.lang.String or byte[] payloads.");
-                return null;
-			}
-
-            if(outBytes.length > 0) {
-                response.getOutputStream().write(outBytes);
-            }
-            response.setContentLength(outBytes.length);
-
-            if (status != null) {
-                response.setStatus(status);
-            } else {
-                response.setStatus(HttpServletResponse.SC_OK);
-            }
-        } catch (IOException e) {
-			throw new MessageDeliverException("Unexpected error when write the message to http response", e);
-		}
-
-        return null;
-	}
-
-	/**
-	 * Method for get request information from a servlet request
-	 * The result includes the http header and other servlet request information
-	 * @param request ServletRequest
-	 * @return Request information includes the http header and other information parsed by
-	 *         servlet container from a servlet request
-	 */
-	public Map<String, Object> getRequestInfo(HttpServletRequest request) {
-        Map<String, Object> requestInfoMap = new HashMap<String, Object>();
-
-        requestInfoMap.put("authType", request.getAuthType());
-        requestInfoMap.put("characterEncoding", request.getCharacterEncoding());
-        requestInfoMap.put("contentType", request.getContentType());
-        requestInfoMap.put("contextPath", request.getContextPath());
-        requestInfoMap.put("localAddr", request.getLocalAddr());
-        requestInfoMap.put("localName", request.getLocalName());
-        requestInfoMap.put("method", request.getMethod());
-        requestInfoMap.put("pathInfo", request.getPathInfo());
-        requestInfoMap.put("protocol", request.getProtocol());
-        requestInfoMap.put("queryString", request.getQueryString());
-        requestInfoMap.put("remoteAddr", request.getRemoteAddr());
-        requestInfoMap.put("remoteHost", request.getRemoteHost());
-        requestInfoMap.put("remoteUser", request.getRemoteUser());
-        requestInfoMap.put("contentLength", Integer.toString(request.getContentLength()));
-        requestInfoMap.put("requestSessionId", request.getRequestedSessionId());
-        requestInfoMap.put("requestURI", request.getRequestURI());
-        requestInfoMap.put("scheme", request.getScheme());
-        requestInfoMap.put("serverName", request.getServerName());
-        requestInfoMap.put("requestPath", request.getServletPath());
-        requestInfoMap.put("pathInfo", request.getPathInfo());
-        if(request.getPathInfo() != null) {
-            requestInfoMap.put("pathInfoTokens", request.getPathInfo().split("/"));
-        } else {
-            requestInfoMap.put("pathInfoTokens", new String[0]);
-        }
-
-        //Add http header
-        Enumeration enumeration = request.getHeaderNames();
-		while (enumeration.hasMoreElements()) {
-			String name = (String) enumeration.nextElement();
-			String value = request.getHeader(name);
-			requestInfoMap.put(name, value);
-		}
-
-        return requestInfoMap;
-	}
-}
\ No newline at end of file

Deleted: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpRequestWrapper.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpRequestWrapper.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpRequestWrapper.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -1,55 +0,0 @@
-/*
- * 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.soa.esb.listeners.gateway;
-
-import org.jboss.soa.esb.Service;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-/**
- * This class wraps the HttpServletRequest and HttpServletResponse
- * It will passed to TomcatMessageComposer to populate or decompose 
- * an ESB message 
- * 
- * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
- */
-public class HttpRequestWrapper {
-	private HttpServletRequest request = null;
-	private HttpServletResponse response = null;
-    private Service service;
-
-    public HttpRequestWrapper(HttpServletRequest req, HttpServletResponse res, Service service) {
-		request = req;
-		response = res;
-        this.service = service;
-    }
-	
-	public HttpServletRequest getRequest() {
-		return request;
-	}
-	
-	public HttpServletResponse getResponse() {
-		return response;
-	}
-
-    public Service getService() {
-        return service;
-    }
-}

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/LegacyHttpMessageComposer.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/LegacyHttpMessageComposer.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/LegacyHttpMessageComposer.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -58,7 +58,7 @@
  * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
  * @deprecated
  */
-public class LegacyHttpMessageComposer<T extends HttpRequestWrapper> extends AbstractMessageComposer<T> {
+public class LegacyHttpMessageComposer<T extends org.jboss.soa.esb.listeners.gateway.http.HttpRequestWrapper> extends AbstractMessageComposer<T> {
 
     private static final Logger logger = Logger.getLogger(LegacyHttpMessageComposer.class);
 

Copied: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java (from rev 29039, labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayServlet.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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-2008, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.gateway.http;
+
+import org.jboss.soa.esb.Service;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.couriers.FaultMessageException;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.listeners.message.MessageComposer;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.config.Configuration;
+import org.jboss.soa.esb.listeners.config.mappers120.HttpGatewayMapper;
+import org.jboss.soa.esb.client.ServiceInvoker;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.ServletConfig;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Map;
+
+/**
+ * Http Gateway Servlet.
+ * <p/>
+ * An instance of this class gets configured for each http-listener urlPattern.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @see org.jboss.internal.soa.esb.listeners.war.HttpGatewayDeploymentFactory
+ */
+public class HttpGatewayServlet extends HttpServlet {
+
+    private Service service;
+    private ServiceInvoker serviceInvoker;
+    private MessageComposer<HttpRequestWrapper> messageComposer;
+    private String mep;
+    private long blockingTimeout;
+    public static final String PAYLOAD_AS = "payloadAs";
+    public static final String EXCEPTION_MAPPINGS = "httpExceptionMappings";
+    private Map<String, Integer> exceptionMappings;
+
+    public void init(ServletConfig config) throws ServletException {
+        service = new Service(config.getInitParameter(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG), config.getInitParameter(ListenerTagNames.TARGET_SERVICE_NAME_TAG));
+        try {
+            serviceInvoker = new ServiceInvoker(service);
+        } catch (MessageDeliverException e) {
+            throw new ServletException("Unable to create ServiceInvoker for Service '" + service + "'.", e);
+        }
+
+        ConfigTree configTree = toConfigTree(config);
+        try {
+            messageComposer = MessageComposer.Factory.getInstance(configTree.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_CLASS_TAG, HttpMessageComposer.class.getName()), configTree);
+        } catch (ConfigurationException e) {
+            throw new ServletException("Failed to create message composer.", e);
+        } catch (MessageDeliverException e) {
+            throw new ServletException("Failed to create message composer.", e);
+        }
+
+        blockingTimeout = configTree.getLongAttribute("synchronousTimeout", 30000);
+        mep = Configuration.getMep(configTree);
+
+        String exceptionMappingsCSV = configTree.getAttribute(EXCEPTION_MAPPINGS);
+        if(exceptionMappingsCSV != null) {
+            try {
+                exceptionMappings = HttpGatewayMapper.decodeExceptionMappingsCSV(exceptionMappingsCSV);
+            } catch (ConfigurationException e) {
+                throw new ServletException("Invalid Exception to HTTP Status mapping configuration.", e);
+            }
+        }
+    }
+
+    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        HttpRequestWrapper wrapper = new HttpRequestWrapper(req, resp, service);
+
+        Message inMessage;
+        try {
+            inMessage = messageComposer.compose(wrapper);
+        } catch (MessageDeliverException e) {
+            throw new ServletException("Failed to create message.", e);
+        }
+
+        Message outMessage;
+        try {
+            // Dispatch the message to the action pipeline, using the service mep to decide
+            // whether to invoke sync or async...
+            if(mep.equals(ListenerTagNames.MEP_REQUEST_RESPONSE)) {
+                outMessage = serviceInvoker.deliverSync(inMessage, blockingTimeout);
+
+                // Set the mep as a header on the response...
+                resp.setHeader("mep", mep);
+            } else {
+                serviceInvoker.deliverAsync(inMessage);
+                resp.setContentLength(0);
+                resp.setStatus(HttpServletResponse.SC_OK);
+
+                // Set the mep as a header on the response...
+                resp.setHeader("mep", mep);
+
+                return;
+            }
+        } catch (MessageDeliverException e) {
+            throw new ServletException("Failed to deliver message.", e);
+        } catch (RegistryException e) {
+            throw new ServletException("Failed to deliver message.", e);
+        } catch (FaultMessageException e) {
+            Throwable cause = e.getCause();
+            if(cause != null && exceptionMappings != null && exceptionMappings.containsKey(cause.getClass().getName())) {
+                String exceptionClass = cause.getClass().getName();
+
+                resp.setStatus(exceptionMappings.get(exceptionClass));
+                resp.setHeader("Exception", exceptionClass);
+
+                e.printStackTrace(resp.getWriter());
+                resp.setContentType("text/plain");
+
+                return;
+            } else {
+                throw new ServletException("Failed to deliver message.", e);
+            }
+        }
+
+        if(outMessage != null) {
+            try {
+                messageComposer.decompose(outMessage, wrapper);
+            } catch (MessageDeliverException e) {
+                throw new ServletException("Failed to decompose response message.", e);
+            }
+        } else {
+            resp.setContentLength(0);
+            resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
+            return;
+        }
+    }
+
+    private ConfigTree toConfigTree(ServletConfig config) {
+        ConfigTree configTree = new ConfigTree("config");
+        Enumeration configNames = config.getInitParameterNames();
+
+        while(configNames.hasMoreElements()) {
+            String name = (String) configNames.nextElement();
+            configTree.setAttribute(name, config.getInitParameter(name));
+        }        
+
+        return configTree;
+    }
+}


Property changes on: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpMessageComposer.java (from rev 29039, labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpMessageComposer.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpMessageComposer.java	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpMessageComposer.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -0,0 +1,309 @@
+/*
+ * 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.soa.esb.listeners.gateway.http;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.*;
+import java.util.regex.Pattern;
+import java.nio.charset.Charset;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.soa.esb.actions.ActionUtils;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.message.AbstractMessageComposer;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.MessagePayloadProxy;
+import org.jboss.soa.esb.message.MessagePayloadProxy.NullPayloadHandling;
+import org.jboss.soa.esb.message.body.content.BytesBody;
+import org.jboss.soa.esb.common.ModulePropertyManager;
+
+/**
+ * Http Message Composer.
+ * <p/>
+ * This class is used to compose the HttpServletRquest
+ * to ESB aware message and decompse the ESB aware message to HttpServletRespones
+ * <p>
+ * This class will put the http request header and other requst information in ESB message properties with the key "RequestInfoMap".
+ * <p>
+ * If the request is the submitted from html form(with the <code>Content-Type: application/x-www-form-urlencoded</code>), HttpServletRequest.getParameterMap() result)
+ * will be put in ESB message properties. The key for it is "RequestParamterMap". It put the the byte array read from request inputstream in message payload.
+ * <p>
+ * In decompose process, the header map in message properties will be added
+ * in HttpServletResponse. The value for "ReponseStatus" store in ESB message properties will
+ * put in the http response. The message payload byte[] or String object will be wrote to HttpServletResponse.
+ * If the object in message payload is not byte[],it will throw exception when the ESB message
+ * is decomposed
+ *
+ * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
+ */
+public class HttpMessageComposer<T extends HttpRequestWrapper> extends AbstractMessageComposer<T> {
+
+    private static final Logger logger = Logger.getLogger(HttpMessageComposer.class);
+
+	/** Request information key in esb message properties */
+	public static final String HTTP_REQUEST_INFO = "RequestInfo";
+
+	/** Reponse header map key in esb message properties */
+	public static final String HTTP_RESPONSE_HEADER_MAP = "ResponseHeaderMap";
+
+	/** Response status key in esb message properties */
+	public static final String HTTP_RESPONSE_STATUS = "ReponseStatus";
+
+	/** Message payload proxy */
+	private MessagePayloadProxy payloadProxy;
+
+    private String payloadAs;
+    private Pattern[] textMimePatterns;
+
+    /*
+	 * Method for configue the payload proxy
+	 */
+	public void setConfiguration(ConfigTree config) {
+		super.setConfiguration(config);
+		payloadProxy = new MessagePayloadProxy(config, new String[] {
+				ActionUtils.POST_ACTION_DATA, Body.DEFAULT_LOCATION,
+				BytesBody.BYTES_LOCATION },
+				new String[] { ActionUtils.POST_ACTION_DATA });
+		payloadProxy.setNullSetPayloadHandling(NullPayloadHandling.LOG);
+
+        payloadAs = config.getAttribute("payloadAs");
+        if(payloadAs == null) {
+            // Get the globally configured text mime types...
+            String[] textTypes = ModulePropertyManager.getPropertyManager("core").getProperty("org.jboss.soa.esb.mime.text.types", "text/*;application/xml;application/*-xml").split(";");
+            textMimePatterns = new Pattern[textTypes.length];
+            for(int i = 0; i < textMimePatterns.length; i++) {
+                textMimePatterns[i] = Pattern.compile(textTypes[i].trim().replace("*", ".*"));
+            }
+        }
+    }
+
+	protected MessagePayloadProxy getPayloadProxy() {
+		return payloadProxy;
+	}
+
+	/*
+	 *Method for populating the ESB aware message from a HttpServletRequest
+	 */
+	@SuppressWarnings("unchecked")
+	protected void populateMessage(Message message, T requestWrapper) throws MessageDeliverException {
+		HttpServletRequest request = requestWrapper.getRequest();
+		byte[] bodyBytes = null;
+
+        try {
+			bodyBytes = StreamUtils.readStream(request.getInputStream());
+		} catch (IOException e) {
+			throw new MessageDeliverException("Failed to read body data from http request", e);
+		}
+
+        String characterEncoding = request.getCharacterEncoding();
+        Charset charset;
+        if(characterEncoding == null) {
+            charset = Charset.defaultCharset();
+        } else {
+            charset = Charset.forName(characterEncoding);
+        }
+
+        if(payloadAs == null) {
+            String contentType = request.getContentType();
+
+            if(contentType != null && isTextMimetype(contentType)) {
+                try {
+                    payloadProxy.setPayload(message, new String(bodyBytes, charset.name()));
+                } catch (UnsupportedEncodingException e) {
+                    throw new MessageDeliverException("Invalid Character encoding '" + characterEncoding + "' set on request.", e);
+                }
+            } else {
+                payloadProxy.setPayload(message, bodyBytes);
+            }
+        } else if(payloadAs.equals("STRING")) {
+            try {
+                payloadProxy.setPayload(message, new String(bodyBytes, charset.name()));
+            } catch (UnsupportedEncodingException e) {
+                throw new MessageDeliverException("Invalid Character encoding '" + characterEncoding + "' set on request.", e);
+            }
+        } else {
+            payloadProxy.setPayload(message, bodyBytes);
+        }
+
+        //Set http request info
+		message.getProperties().setProperty(HTTP_REQUEST_INFO, getRequestInfo(request));
+	}
+
+    private boolean isTextMimetype(String contentType) {
+        for(int i = 0; i < textMimePatterns.length; i++) {
+            if(textMimePatterns[i].matcher(contentType).matches()) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+
+    /*
+    * Method for decompsing a esb message to a HttpServletResponse
+    */
+	@SuppressWarnings("unchecked")
+	public Object decompose(Message message, T requestWrapper) throws MessageDeliverException {
+        HttpServletRequest request = requestWrapper.getRequest();
+        HttpServletResponse  response = requestWrapper.getResponse();
+        Map<String, String> headers;
+        Integer status;
+
+        try {
+            headers = (Map<String, String>) message.getProperties().getProperty(HTTP_RESPONSE_HEADER_MAP);
+        } catch(ClassCastException e) {
+            response.setStatus(HttpServletResponse.SC_BAD_GATEWAY);
+            logger.debug("'" + HTTP_RESPONSE_HEADER_MAP + "' must be of type " + Map.class.getName());
+            return null;
+        }
+
+        try {
+            status = (Integer) message.getProperties().getProperty(HTTP_RESPONSE_STATUS);
+        } catch(ClassCastException e) {
+            response.setStatus(HttpServletResponse.SC_BAD_GATEWAY);
+            logger.debug("'" + HTTP_RESPONSE_STATUS + "' must be of type Integer.");
+            return null;
+        }
+
+        if (headers != null) {
+            Set<Map.Entry<String, String>> entries = headers.entrySet();
+            for(Map.Entry<String, String> entry : entries) {
+                String headerName = entry.getKey();
+                if(headerName.equals("Content-Type")) {
+                    response.setContentType(entry.getValue());
+                } else {
+                    response.setHeader(entry.getKey(), entry.getValue());
+                }
+            }
+        }
+
+		Object obj = payloadProxy.getPayload(message);
+		try {
+            byte[] outBytes;
+
+            if (obj instanceof String) {
+                String encoding = request.getCharacterEncoding();
+                if(encoding == null) {
+                    encoding = "UTF-8";
+                }
+                outBytes = ((String) obj).getBytes(encoding);
+            } else if (obj instanceof byte[]) {
+				outBytes = (byte[]) obj;
+            } else if (obj == null) {
+                response.setContentLength(0);
+                response.setStatus(HttpServletResponse.SC_NO_CONTENT);
+                logger.debug("Expected a response payload from '" + ListenerTagNames.MEP_REQUEST_RESPONSE + "' service '" + requestWrapper.getService() + "', but received none.");
+                return null;
+            } else {
+                response.setContentLength(0);
+                response.setStatus(HttpServletResponse.SC_BAD_GATEWAY);
+                logger.debug("Unsupport HTTP response payload type " + obj.getClass().getName() + " from service '" + requestWrapper.getService() + "'.  Only supports java.lang.String or byte[] payloads.");
+                return null;
+			}
+
+            if(outBytes.length > 0) {
+                response.getOutputStream().write(outBytes);
+            }
+            response.setContentLength(outBytes.length);
+
+            if (status != null) {
+                response.setStatus(status);
+            } else {
+                response.setStatus(HttpServletResponse.SC_OK);
+            }
+        } catch (IOException e) {
+			throw new MessageDeliverException("Unexpected error when write the message to http response", e);
+		}
+
+        return null;
+	}
+
+	/**
+	 * Method for get request information from a servlet request
+	 * The result includes the http header and other servlet request information
+	 * @param request ServletRequest
+	 * @return Request information includes the http header and other information parsed by
+	 *         servlet container from a servlet request
+	 */
+	public HttpRequestInfo getRequestInfo(HttpServletRequest request) {
+        HttpRequestInfo requestInfo = new HttpRequestInfo();
+
+        requestInfo.setAuthType(request.getAuthType());
+        requestInfo.setCharacterEncoding(request.getCharacterEncoding());
+        requestInfo.setContentType(request.getContentType());
+        requestInfo.setContextPath(request.getContextPath());
+        requestInfo.setLocalAddr(request.getLocalAddr());
+        requestInfo.setLocalName(request.getLocalName());
+        requestInfo.setMethod(request.getMethod());
+        requestInfo.setProtocol(request.getProtocol());
+        requestInfo.setQueryString(request.getQueryString());
+        requestInfo.setRemoteAddr(request.getRemoteAddr());
+        requestInfo.setRemoteHost(request.getRemoteHost());
+        requestInfo.setRemoteUser(request.getRemoteUser());
+        requestInfo.setContentLength(request.getContentLength());
+        requestInfo.setRequestSessionId(request.getRequestedSessionId());
+        requestInfo.setRequestURI(request.getRequestURI());
+        requestInfo.setScheme(request.getScheme());
+        requestInfo.setServerName(request.getServerName());
+        requestInfo.setRequestPath(request.getServletPath());
+
+        String pathInfo = request.getPathInfo();
+        requestInfo.setPathInfo(pathInfo);
+
+        if(pathInfo != null) {
+            List<String> pathInfoTokens = requestInfo.getPathInfoTokens();
+
+            pathInfoTokens.addAll(Arrays.asList(request.getPathInfo().split("/")));
+
+            // remove empty tokens...
+            Iterator<String> tokensIterator = pathInfoTokens.iterator();
+            while(tokensIterator.hasNext()) {
+                if(tokensIterator.next().trim().length() == 0) {
+                    tokensIterator.remove();
+                }
+            }
+        }
+
+        // Http Query params...
+        Map paramMap = request.getParameterMap();
+        if(paramMap != null) {
+            requestInfo.getQueryParams().putAll(paramMap);
+        }
+
+        // Http headers...
+        Enumeration enumeration = request.getHeaderNames();
+		while (enumeration.hasMoreElements()) {
+			String name = (String) enumeration.nextElement();
+			String value = request.getHeader(name);
+			requestInfo.getHeaders().put(name, value);
+		}
+
+        return requestInfo;
+	}
+}
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpMessageComposer.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpRequestInfo.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpRequestInfo.java	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpRequestInfo.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -0,0 +1,220 @@
+/*
+ * 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.soa.esb.listeners.gateway.http;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+import java.io.Serializable;
+
+/**
+ * HTTP Request Information.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class HttpRequestInfo implements Serializable {
+    
+    private String authType;
+    private String characterEncoding;
+    private String contentType;
+    private String contextPath;
+    private String localAddr;
+    private String localName;
+    private String method;
+    private String pathInfo;
+    private String protocol;
+    private String queryString;
+    private String remoteAddr;
+    private String remoteHost;
+    private String remoteUser;
+    private int contentLength;
+    private String requestSessionId;
+    private String requestURI;
+    private String scheme;
+    private String serverName;
+    private String requestPath;
+    private List<String> pathInfoTokens = new ArrayList<String>();
+    private Map<String, String[]> queryParams = new HashMap<String, String[]>();
+    private Map<String, String> headers = new HashMap<String, String>();
+
+    public String getAuthType() {
+        return authType;
+    }
+
+    public void setAuthType(String authType) {
+        this.authType = authType;
+    }
+
+    public String getCharacterEncoding() {
+        return characterEncoding;
+    }
+
+    public void setCharacterEncoding(String characterEncoding) {
+        this.characterEncoding = characterEncoding;
+    }
+
+    public String getContentType() {
+        return contentType;
+    }
+
+    public void setContentType(String contentType) {
+        this.contentType = contentType;
+    }
+
+    public String getContextPath() {
+        return contextPath;
+    }
+
+    public void setContextPath(String contextPath) {
+        this.contextPath = contextPath;
+    }
+
+    public String getLocalAddr() {
+        return localAddr;
+    }
+
+    public void setLocalAddr(String localAddr) {
+        this.localAddr = localAddr;
+    }
+
+    public String getLocalName() {
+        return localName;
+    }
+
+    public void setLocalName(String localName) {
+        this.localName = localName;
+    }
+
+    public String getMethod() {
+        return method;
+    }
+
+    public void setMethod(String method) {
+        this.method = method;
+    }
+
+    public String getPathInfo() {
+        return pathInfo;
+    }
+
+    public void setPathInfo(String pathInfo) {
+        this.pathInfo = pathInfo;
+    }
+
+    public String getProtocol() {
+        return protocol;
+    }
+
+    public void setProtocol(String protocol) {
+        this.protocol = protocol;
+    }
+
+    public String getQueryString() {
+        return queryString;
+    }
+
+    public void setQueryString(String queryString) {
+        this.queryString = queryString;
+    }
+
+    public String getRemoteAddr() {
+        return remoteAddr;
+    }
+
+    public void setRemoteAddr(String remoteAddr) {
+        this.remoteAddr = remoteAddr;
+    }
+
+    public String getRemoteHost() {
+        return remoteHost;
+    }
+
+    public void setRemoteHost(String remoteHost) {
+        this.remoteHost = remoteHost;
+    }
+
+    public String getRemoteUser() {
+        return remoteUser;
+    }
+
+    public void setRemoteUser(String remoteUser) {
+        this.remoteUser = remoteUser;
+    }
+
+    public int getContentLength() {
+        return contentLength;
+    }
+
+    public void setContentLength(int contentLength) {
+        this.contentLength = contentLength;
+    }
+
+    public String getRequestSessionId() {
+        return requestSessionId;
+    }
+
+    public void setRequestSessionId(String requestSessionId) {
+        this.requestSessionId = requestSessionId;
+    }
+
+    public String getRequestURI() {
+        return requestURI;
+    }
+
+    public void setRequestURI(String requestURI) {
+        this.requestURI = requestURI;
+    }
+
+    public String getScheme() {
+        return scheme;
+    }
+
+    public void setScheme(String scheme) {
+        this.scheme = scheme;
+    }
+
+    public String getServerName() {
+        return serverName;
+    }
+
+    public void setServerName(String serverName) {
+        this.serverName = serverName;
+    }
+
+    public String getRequestPath() {
+        return requestPath;
+    }
+
+    public void setRequestPath(String requestPath) {
+        this.requestPath = requestPath;
+    }
+
+    public List<String> getPathInfoTokens() {
+        return pathInfoTokens;
+    }
+
+    public Map<String, String[]> getQueryParams() {
+        return queryParams;
+    }
+
+    public Map<String, String> getHeaders() {
+        return headers;
+    }
+}

Copied: labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpRequestWrapper.java (from rev 29039, labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpRequestWrapper.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpRequestWrapper.java	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpRequestWrapper.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -0,0 +1,55 @@
+/*
+ * 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.soa.esb.listeners.gateway.http;
+
+import org.jboss.soa.esb.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+/**
+ * This class wraps the HttpServletRequest and HttpServletResponse
+ * It will passed to TomcatMessageComposer to populate or decompose 
+ * an ESB message 
+ * 
+ * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
+ */
+public class HttpRequestWrapper {
+	private HttpServletRequest request = null;
+	private HttpServletResponse response = null;
+    private Service service;
+
+    public HttpRequestWrapper(HttpServletRequest req, HttpServletResponse res, Service service) {
+		request = req;
+		response = res;
+        this.service = service;
+    }
+	
+	public HttpServletRequest getRequest() {
+		return request;
+	}
+	
+	public HttpServletResponse getResponse() {
+		return response;
+	}
+
+    public Service getService() {
+        return service;
+    }
+}

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/build.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/build.xml	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/build.xml	2009-08-25 17:00:25 UTC (rev 29056)
@@ -5,7 +5,7 @@
 		${line.separator}
 	</description>
 	
-    <property name="additional.deploys" value="sales-web.xml,sales-jboss-web.xml" />
+    <property name="additional.deploys" value="http-exception-mappings.properties" />
 
 	<!-- Import the base Ant build script... -->
 	<import file="../conf/base-build.xml"/> 	

Added: labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/http-exception-mappings.properties
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/http-exception-mappings.properties	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/http-exception-mappings.properties	2009-08-25 17:00:25 UTC (rev 29056)
@@ -0,0 +1 @@
+org.jboss.soa.esb.samples.quickstart.httpgateway.MyActionException=502
\ No newline at end of file

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/jboss-esb.xml	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/jboss-esb.xml	2009-08-25 17:00:25 UTC (rev 29056)
@@ -17,6 +17,9 @@
             </http-bus>
 
             <auth method="BASIC" domain="java:/jaas/JBossWS" /> <!-- uname: "kermit" pw: "thefrog" -->
+
+            <!-- Global exception mappings file... -->
+            <exception mappingsFile="/http-exception-mappings.properties" />
         </http-provider>
     </providers>
 
@@ -44,6 +47,31 @@
             </actions>
         </service>
 
+        <service category="Exceptions" name="Exception1" description="" invmScope="GLOBAL">
+            <listeners>
+                <http-gateway name="Exception2" />
+            </listeners>
+            <actions mep="RequestResponse">
+                <!-- Uses the globally defined exception mappings defined on the <http-provider>... -->
+                <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyExceptionAction"/>
+            </actions>
+        </service>
+
+        <service category="Exceptions" name="Exception2" description="" invmScope="GLOBAL">
+            <listeners>
+                <http-gateway name="Exception1">
+                    <!-- Override the exception mappings defined on the <http-provider>... -->
+                    <exception mappingsFile="">
+                        <mapping class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyActionException" status="503" />
+                    </exception>
+                </http-gateway>
+            </listeners>
+            <actions mep="RequestResponse">
+                <!-- Uses the override exception mappings defined on the <http-gateway>... -->
+                <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyExceptionAction"/>
+            </actions>
+        </service>
+
     </services>
 
 </jbossesb>
\ No newline at end of file

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/readme.txt
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/readme.txt	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/readme.txt	2009-08-25 17:00:25 UTC (rev 29056)
@@ -20,4 +20,12 @@
        b) http://localhost:8080/Quickstart_http_gateway/http/index/XXXX/yyy?a=1,b=2 - Will be routed to the Index:List
           service.  Will return some details about the request.  This Service's <http-listener> does not refer
           to any bus and so simply uses the "default" http bus.
+       c) http://localhost:8080/Quickstart_http_gateway/http/Exceptions/Exception1 - Will be routed to the
+          Exceptions:Exception1 service.  This service throws a "MyActionException", resulting in a
+          502 (Bad Gateway) status being returned in accordance with the Exception to HTTP status code
+          mappings defined globally on the <http-provider>.
+       d) http://localhost:8080/Quickstart_http_gateway/http/Exceptions/Exception2 - Will be routed to the
+          Exceptions:Exception2 service.  This service also throws a "MyActionException", but the <http-gateway>
+          on this service overrides the globally defined Exception to HTTP status code mappings defined globally
+          on the <http-provider> to return a 503 (Service Unavailable) status for the "MyActionException" exception.
   3. In this folder ("Window1"), type 'ant undeploy'.

Deleted: labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/sales-jboss-web.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/sales-jboss-web.xml	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/sales-jboss-web.xml	2009-08-25 17:00:25 UTC (rev 29056)
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<jboss-web>
-    <context-root>/sales-portal</context-root>
-</jboss-web>
\ No newline at end of file

Deleted: labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/sales-web.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/sales-web.xml	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/sales-web.xml	2009-08-25 17:00:25 UTC (rev 29056)
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app xmlns="http://java.sun.com/xml/ns/javaee"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
-         version="2.5">
-
-    <security-constraint>
-        <web-resource-collection>
-            <web-resource-name>Secure Content</web-resource-name>
-            <url-pattern>/close/*</url-pattern>
-        </web-resource-collection>
-        <auth-constraint>
-            <role-name>JBossAdmin</role-name>
-        </auth-constraint>
-        <user-data-constraint>
-            <transport-guarantee>NONE</transport-guarantee>
-        </user-data-constraint>
-    </security-constraint>
-
-    <login-config>
-        <auth-method>BASIC</auth-method>
-        <realm-name>Sales Service</realm-name>
-    </login-config>
-
-    <security-role>
-        <description>The role required to access restricted content</description>
-        <role-name>JBossAdmin</role-name>
-    </security-role>
-
-</web-app>

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -20,19 +20,20 @@
  */
 package org.jboss.soa.esb.samples.quickstart.httpgateway;
 
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Arrays;
+import java.beans.XMLEncoder;
+import java.io.ByteArrayOutputStream;
 
-import org.jboss.soa.esb.actions.AbstractActionLifecycle;
 import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
 import org.jboss.soa.esb.actions.ActionProcessingException;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.listeners.gateway.HttpMessageComposer;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.gateway.http.HttpMessageComposer;
+import org.jboss.soa.esb.listeners.gateway.http.HttpRequestInfo;
 import org.jboss.soa.esb.Service;
 
+import com.thoughtworks.xstream.XStream;
+
 public class MyAction extends AbstractActionPipelineProcessor {
 
 	protected ConfigTree _config;
@@ -45,33 +46,20 @@
 
     public Message process(Message message) throws ActionProcessingException {
 
-		System.out.println("&&&&&&&&&&&&&&&& MyAction &&&&&&&&&&&&&&&&&&&&&");
+        System.out.println("&&&&&&&&&&&&&&&& MyAction &&&&&&&&&&&&&&&&&&&&&");
         System.out.println("");
         System.out.println("Service: " + service);
         System.out.println("");
-        System.out.println("------------Http Request Info-------------------");
-		Map requestInfo = (Map)message.getProperties().getProperty("RequestInfoMap");
-		requestInfo.get("Method");
-		Iterator<String> infoIte = requestInfo.keySet().iterator();
-		while(infoIte.hasNext()) {
-			String key = infoIte.next();
-			System.out.println(key + " : " + requestInfo.get(key));
-		}
+        System.out.println("------------Http Request Info (XStream Encoded)-------------------");
+		HttpRequestInfo requestInfo = (HttpRequestInfo) message.getProperties().getProperty(HttpMessageComposer.HTTP_REQUEST_INFO);
+        String requestInfoXML;
 
+        XStream xstream = new XStream();
+        requestInfoXML = xstream.toXML(requestInfo);
 
-		System.out.println("------------Http Prameter Map-------------------");
-		Map paraMap = (Map) message.getProperties().getProperty(HttpMessageComposer.HTTP_REQUEST_PARAMETER_MAP);
+        System.out.println(requestInfoXML);
 
-		if (paraMap != null) {
-			Iterator<String> paraIte = paraMap.keySet().iterator();
-			while(paraIte.hasNext()) {
-				String key = paraIte.next();
-				System.out.println(key + " : " + paraMap.get(key));
-			}
-		}
-
-
-		System.out.println("------------Http Request body -------------------");
+        System.out.println("------------Http Request body -------------------");
 		System.out.println(new String((byte[])message.getBody().get()));
 
 		System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
@@ -79,12 +67,8 @@
         StringBuilder response = new StringBuilder();
 
         response.append("Service: " + service + "\n\n");
-        response.append("pathInfo: " + requestInfo.get("pathInfo") + "\n");
-        String[] pathInfoTokens = (String[]) requestInfo.get("pathInfoTokens");
-        if(pathInfoTokens != null) {
-            response.append("pathInfoTokens: " + Arrays.asList(requestInfo.get("pathInfoTokens")).toString() + "\n");
-        }
-        response.append("params: " + paraMap + "\n");
+        response.append("------------Http Request Info (XStream Encoded)-------------------\n");
+        response.append(requestInfoXML);
 
         message.getBody().add(response.toString());
 

Added: labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyActionException.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyActionException.java	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyActionException.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -0,0 +1,31 @@
+/*
+ * 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.soa.esb.samples.quickstart.httpgateway;
+
+import org.jboss.soa.esb.actions.ActionProcessingException;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class MyActionException extends ActionProcessingException {
+    public MyActionException(String message) {
+        super(message);
+    }
+}

Copied: labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyExceptionAction.java (from rev 29039, labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyAction.java)
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyExceptionAction.java	                        (rev 0)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyExceptionAction.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -0,0 +1,36 @@
+/*
+ * 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,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.httpgateway;
+
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+public class MyExceptionAction extends AbstractActionPipelineProcessor {
+
+    public MyExceptionAction(ConfigTree config) {
+    }
+
+    public Message process(Message message) throws ActionProcessingException {
+        throw new MyActionException("MyActionException!!!!");
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/src/org/jboss/soa/esb/samples/quickstart/httpgateway/MyExceptionAction.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/tfennelly/httpg2/qa/quickstarts/src/org/jboss/soa/esb/quickstart/test/HttpGatewayTest.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/qa/quickstarts/src/org/jboss/soa/esb/quickstart/test/HttpGatewayTest.java	2009-08-25 15:40:04 UTC (rev 29055)
+++ labs/jbossesb/workspace/tfennelly/httpg2/qa/quickstarts/src/org/jboss/soa/esb/quickstart/test/HttpGatewayTest.java	2009-08-25 17:00:25 UTC (rev 29056)
@@ -56,9 +56,7 @@
             String response = StreamUtils.readReader(reader);
 
             assertTrue(response.indexOf("Service: Index:List") != -1);
-            assertTrue(response.indexOf("pathInfo: /XXXX/yyy") != -1);
-            assertTrue(response.indexOf("pathInfoTokens: [, XXXX, yyy]") != -1);
-            assertTrue(response.indexOf("params: {param1=") != -1);
+            assertTrue(response.indexOf("<pathInfo>/XXXX/yyy</pathInfo>") != -1);
         } finally {
             reader.close();
         }



More information about the jboss-svn-commits mailing list