[jboss-svn-commits] JBL Code SVN: r23618 - in labs/jbossesb/workspace/mlittle/legstar/product: lib/ext and 15 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Oct 29 10:36:09 EDT 2008


Author: jim.ma
Date: 2008-10-29 10:36:09 -0400 (Wed, 29 Oct 2008)
New Revision: 23618

Added:
   labs/jbossesb/workspace/mlittle/legstar/product/lib/ext/jbossweb.jar
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/TomcatListenerMapper.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatDispatchServlet.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatGatewayListener.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatMessageComposer.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatRequestWrapper.java
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/build.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/deployment.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbm-queue-service.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbmq-queue-service.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jboss-esb.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbossesb-properties.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jndi.properties
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/juddi.properties
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/lib/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/log4j.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/readme.txt
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/MyAction.java
Modified:
   labs/jbossesb/workspace/mlittle/legstar/product/etc/schemas/xml/jbossesb-1.0.1.xsd
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.java
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java
Log:
Initial commit for tomcat gateway listener and sample for it

Modified: labs/jbossesb/workspace/mlittle/legstar/product/etc/schemas/xml/jbossesb-1.0.1.xsd
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/etc/schemas/xml/jbossesb-1.0.1.xsd	2008-10-29 12:43:48 UTC (rev 23617)
+++ labs/jbossesb/workspace/mlittle/legstar/product/etc/schemas/xml/jbossesb-1.0.1.xsd	2008-10-29 14:36:09 UTC (rev 23618)
@@ -1603,7 +1603,83 @@
 		</xsd:complexType>
 	</xsd:element>
 
+
+
 	<!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
+		Tomcat Http Type Implementations.
+		88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
+	<xsd:element name="tomcat-bus" substitutionGroup="jesb:bus">
+		<xsd:annotation>
+			<xsd:documentation xml:lang="en">
+			     Tomcat Bus 
+			</xsd:documentation>
+		</xsd:annotation>
+		<xsd:complexType>
+			<xsd:complexContent>
+				<xsd:extension base="jesb:bus">
+					<xsd:attribute name="context" type="xsd:string"
+						use="required">
+						<xsd:annotation>
+							<xsd:documentation xml:lang="en">
+								Http server startup context
+							</xsd:documentation>
+						</xsd:annotation>
+					</xsd:attribute>
+				</xsd:extension>
+			</xsd:complexContent>
+		</xsd:complexType>
+	</xsd:element>
+	<xsd:element name="tomcat-provider"
+		substitutionGroup="jesb:provider">
+		<xsd:annotation>
+			<xsd:documentation xml:lang="en">
+				Tomcat based http Provider.
+			</xsd:documentation>
+		</xsd:annotation>
+		<xsd:complexType>
+			<xsd:complexContent>
+				<xsd:extension base="jesb:bus-provider">
+					<xsd:attribute name="host" type="xsd:string" use="required">
+						<xsd:annotation>
+							<xsd:documentation xml:lang="en" >
+								Tomcat based Server bind address. When
+								not specified, defaults to
+								InetAddress.getLocalHost().getHostName().
+							</xsd:documentation>
+						</xsd:annotation>
+					</xsd:attribute>
+
+					<xsd:attribute name="port" type="xsd:int" use="required">
+						<xsd:annotation>
+							<xsd:documentation xml:lang="en">
+								Tomcat based http server listen port
+							</xsd:documentation>
+						</xsd:annotation>
+					</xsd:attribute>
+
+				</xsd:extension>
+			</xsd:complexContent>
+		</xsd:complexType>
+	</xsd:element>
+	<xsd:element name="tomcat-listener"
+		substitutionGroup="jesb:listener">
+		<xsd:annotation>
+			<xsd:documentation xml:lang="en">
+				Tomcat based http Listener.
+			</xsd:documentation>
+		</xsd:annotation>
+		<xsd:complexType>
+			<xsd:complexContent>
+				<xsd:extension base="jesb:listener" />
+			</xsd:complexContent>
+		</xsd:complexType>
+	</xsd:element>
+
+
+
+
+
+	<!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
 		Groovy Gateway Type Implementations.
 		88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
 	<xsd:element name="groovy-listener"

Added: labs/jbossesb/workspace/mlittle/legstar/product/lib/ext/jbossweb.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/workspace/mlittle/legstar/product/lib/ext/jbossweb.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java	2008-10-29 12:43:48 UTC (rev 23617)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java	2008-10-29 14:36:09 UTC (rev 23618)
@@ -36,6 +36,7 @@
 import org.jboss.soa.esb.listeners.config.xbeanmodel.JmsListenerDocument.JmsListener;
 import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
 import org.jboss.soa.esb.listeners.config.xbeanmodel.SqlListenerDocument.SqlListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.TomcatListenerDocument.TomcatListener;
 import org.jboss.soa.esb.listeners.config.xbeanmodel.Listener;
 import org.jboss.soa.esb.listeners.config.xbeanmodel.JcaGatewayDocument;
 import org.jboss.soa.esb.listeners.config.xbeanmodel.AbstractScheduledListener;
@@ -124,6 +125,7 @@
      * @throws ConfigurationException Invalid listener configuration.
      */
     private void addGatewayConfig(Element root, Listener gateway) throws ConfigurationException {
+    	System.out.println("---use new gateway geneartor ----");
         Element listenerConfig;
 
         // Of course we could do the following reflectively if we really want to - TODO perhaps!!
@@ -139,6 +141,8 @@
             listenerConfig = SqlListenerMapper.map(root, (SqlListener) gateway, model);
         } else if (gateway instanceof JbrListener) {
             listenerConfig = JbrListenerMapper.map(root, (JbrListener) gateway, model);
+        } else if (gateway instanceof TomcatListener) {
+            listenerConfig = TomcatListenerMapper.map(root, (TomcatListener) gateway, model);    
         } else if (gateway instanceof GroovyListener) {
             listenerConfig = GroovyListenerMapper.map(root, (GroovyListener) gateway, model);
         } else if (gateway instanceof HibernateListener) {

Added: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/TomcatListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/TomcatListenerMapper.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/TomcatListenerMapper.java	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,88 @@
+/*
+ * 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.config.mappers;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.dom.YADOMUtil;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.TomcatBusDocument.TomcatBus;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.TomcatListenerDocument.TomcatListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.TomcatProviderDocument.TomcatProvider;
+import org.jboss.soa.esb.listeners.gateway.TomcatGatewayListener;
+import org.w3c.dom.Element;
+
+/**
+ * Http listener mapper.
+ * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
+ */
+public class TomcatListenerMapper {
+	 /**
+     * Perform the Tomcat listener mapping.
+     * @param root The "ConfigTree" configuration root node.
+     * @param listener tomcat listener config.
+     * @param model The configuration model from which the mapping is being performed.
+     * @return The ConfigTree listener configuration node.
+     * @throws org.jboss.soa.esb.ConfigurationException Invalid listener configuration.
+     */
+    public static Element map(Element root, TomcatListener listener, XMLBeansModel model) throws ConfigurationException {
+        Element listenerNode = YADOMUtil.addElement(root, "listener");
+        TomcatBus bus;
+        TomcatProvider provider;
+
+        listenerNode.setAttribute("name", listener.getName());
+
+        try {
+            bus = (TomcatBus) model.getBus(listener.getBusidref());
+        } catch (ClassCastException e) {
+            throw new ConfigurationException("Invalid busid reference [" + listener.getBusidref() + "] on listener [" + listener.getName() + "].  A <http-listener> must reference a <http-bus>.");
+        }
+        try {
+            provider = (TomcatProvider) model.getProvider(bus);
+        } catch (ClassCastException e) {
+            throw new ConfigurationException("Invalid bus config [" + listener.getBusidref() + "].  Should be contained within a <http-provider> instance.  Unexpected exception - this should have caused a validation error!");
+        }
+
+        // Map the standard listener attributes - common across all listener types...
+        MapperUtil.mapDefaultAttributes(listener, listenerNode, model);
+        // Map the <property> elements targeted at the listener - from the listener itself.
+        MapperUtil.mapProperties(provider.getPropertyList(), listenerNode);
+        MapperUtil.mapProperties(bus.getPropertyList(), listenerNode);
+        MapperUtil.mapProperties(listener.getPropertyList(), listenerNode);
+
+        if(listener.getIsGateway()) {
+            String host = provider.getHost();
+            int port = provider.getPort();
+            
+            listenerNode.setAttribute("gatewayClass", TomcatGatewayListener.class.getName());
+			listenerNode.setAttribute(ListenerTagNames.IS_GATEWAY_TAG, Boolean.toString(listener.getIsGateway()));
+
+            if(host != null) {
+                listenerNode.setAttribute(TomcatGatewayListener.SERVER_HOST_TAG, host);
+            }
+            listenerNode.setAttribute(TomcatGatewayListener.REQUEST_CONTEXT_TAG, bus.getContext());
+            listenerNode.setAttribute(TomcatGatewayListener.SERVER_PORT_TAG, Integer.toString(port));
+        } else {
+            throw new ConfigurationException("Invalid <tomcat-listener> config [" + listener.getName() + "].  <tomcat-listener> is currently only supported as a gateway listener.");
+        }
+
+        return listenerNode;
+    }
+}

Added: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatDispatchServlet.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatDispatchServlet.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatDispatchServlet.java	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,130 @@
+/*
+ * 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 javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+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.message.UncomposedMessageDeliveryAdapter;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * This class is for dispatching the http request to ESB action process pipe
+ * line.By default, this servlet will be used to set to default servlet mapping
+ * in tomcat StandardContext. This class is subclass of DefaultServlet
+ * 
+ * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
+ */
+public class TomcatDispatchServlet extends HttpServlet {
+	private static final long serialVersionUID = 1L;
+
+	/** If this a synchronous invocation * */
+	private boolean synchronous = true;
+
+	private int serviceTimeout = 2000;
+
+	/** ESB message delivery adapter */
+	public UncomposedMessageDeliveryAdapter messageDeliveryAdapter = null;
+
+	/**
+	 * Initilize method
+	 * 
+	 * @throws ServletException
+	 *             If error occured
+	 */
+	public void init() throws ServletException {
+		ConfigTree config = (ConfigTree) getServletContext().getAttribute(
+				"config");
+		synchronous = !config.getAttribute("synchronous", "true")
+				.equalsIgnoreCase("false");
+
+		serviceTimeout = Integer.parseInt(config.getAttribute("serviceTimeout",
+				"20000"));
+
+		try {
+			messageDeliveryAdapter = UncomposedMessageDeliveryAdapter
+					.getGatewayDeliveryAdapter(config,
+							new TomcatMessageComposer<TomcatRequestWrapper>());
+		} catch (ConfigurationException e) {
+			throw new ServletException(e);
+		}
+
+	}
+
+	/**
+	 * Service method to process the inboud servlet request and reply the http
+	 * servlet response
+	 * 
+	 * @param request
+	 *            HttpServlet request
+	 * @param response
+	 *            HttpServlet response
+	 * @param content
+	 * @throws ServletException
+	 *             For error occured during process
+	 */
+	protected void serveRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+		TomcatRequestWrapper wrapper = new TomcatRequestWrapper(request,
+				response);
+
+		try {
+			if (synchronous) {
+				messageDeliveryAdapter.deliverSync(wrapper, serviceTimeout);
+			} else {
+				messageDeliveryAdapter.deliverAsync(wrapper);
+			}
+		} catch (FaultMessageException fme) {
+			Message faultMessage = fme.getReturnedMessage();
+			if (faultMessage != null) {
+				Object obj = faultMessage.getProperties().getProperty(TomcatMessageComposer.HTTP_RESPONSE_STATUS);
+			    if (obj != null && obj instanceof Integer) {
+			    	response.setStatus((Integer)obj);
+			    } else {
+			    	response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+			    }
+			    
+			    fme.printStackTrace(response.getWriter());			    
+			}
+			
+		} catch (Exception ex) {
+			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+			ex.printStackTrace(response.getWriter());
+		} 
+
+	}
+	
+	
+	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+		serveRequest(request, response);
+	}
+	
+	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+	    doGet(request, response);
+	}
+		
+}

Added: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatGatewayListener.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatGatewayListener.java	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,438 @@
+/*
+ * 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.net.URI;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardHost;
+import org.apache.catalina.core.StandardWrapper;
+import org.apache.catalina.startup.ContextConfig;
+import org.apache.log4j.Logger;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
+import org.jboss.soa.esb.listeners.message.UncomposedMessageDeliveryAdapter;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.RegistryFactory;
+
+/**
+ * Tomcat Listener provids the functionality to pass the http request 
+ * to ESB service . 
+ * <p> This class will generate {@link org.apache.catalina.connector.Connector}, 
+ * {@link org.apache.catalina.core.StandardHost} and {@link org.apache.catalina.core.StandardContext} 
+ * for user defined http port, host and context. These generated tomcat components will be 
+ * attached to jboss embeded tomcat(aka jboss web). You can monitor and control these new generated
+ * components through jboss JMX console.  When this listener is stoped, these components will be 
+ * destoried automatically.
+ * 
+ * <p>The different tomcat listner can be started in same port and different context. This will allow
+ * user define the server locator uses jboss default http port 8080, for example: 
+ * <code> http://localhost:8080/jbossesb/servicecategory/servicename </code>
+ *
+ * <p>This class uses the {@link org.jboss.soa.esb.listeners.gateway.TomcatMessageComposer}
+ * by default.
+ * @see org.jboss.soa.esb.listeners.gateway.TomcatMessageComposer
+ * @see Torg.jboss.soa.esb.listeners.gateway.TomcatDispatchServlet 
+ * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
+ */
+public class TomcatGatewayListener extends AbstractManagedLifecycle {
+
+	private static final long serialVersionUID = 1L;
+	
+	
+	private static Logger logger = Logger.getLogger(TomcatGatewayListener.class);
+
+    
+	/**The tag used to read the host value from configuration */
+	public static String SERVER_HOST_TAG = "http_host";
+	
+	/**The tag used to read the port value from configuration */	
+	public static String SERVER_PORT_TAG = "http_port";
+	
+	/**The tag used to read the context value from configuration */	
+	public static String REQUEST_CONTEXT_TAG = "http_context";
+	
+	/**The tag used to read the dispatch servlet class name value from configuration */	
+	public static String DISPATCH_SERVLET_CLASS = "dispatch_servlet";
+	
+	/**Record the count that the same host name is referenced by other Tomcat listener instance */
+	public static Map<String, Integer> hostReference= new java.util.HashMap<String, Integer>(); 
+	
+	/**Record the count that the same connector/port is referenced by other Tomcat listener instance */
+	public static Map<String, Integer> connectorReference= new java.util.HashMap<String, Integer>(); 
+	
+
+	/**Http host value*/
+	public String host = null;
+	
+	/**Http port value*/
+	public String port = null;
+	
+	/**listener contenxt */
+	public String httpContext = null;
+
+	/**Recored if this listener is already intilized*/
+	private boolean initialized = false;
+
+	/** Endpoint reference that presents this listener */
+	private EPR endpointReference = null;
+	
+	/**Service category*/
+	private String serviceCategory = null;
+	
+	/**Service name*/
+	private String serviceName = null;
+	
+	/** MBean server */
+	private MBeanServer mbeanServer = null;
+	
+	/**The new created tomcat standard context, it reprents a web app*/
+	private StandardContext ctx = null;
+	
+	/** The domian name for JBoss embeded tomcat engine*/
+	private String jbossWebDomain = null;
+	
+	
+	/** The default servlet used to dispatch the http request to ESB service*/
+	private String dispatchServletClassName = TomcatDispatchServlet.class.getName();
+	
+    
+	/**Constuct the TomcatGatewyListner
+	 * @param config The listener configuration
+	 * @throws ConfigurationException Exception during construction
+	 */
+	public TomcatGatewayListener(ConfigTree config) throws ConfigurationException {
+		super(config);
+		host = config.getAttribute(this.SERVER_HOST_TAG);
+		port = config.getAttribute(this.SERVER_PORT_TAG);
+		httpContext = config.getAttribute(this.REQUEST_CONTEXT_TAG);		
+		serviceCategory = config.getAttribute(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG);
+		serviceName = config.getAttribute(ListenerTagNames.TARGET_SERVICE_NAME_TAG);
+		
+		if (config.getAttribute(DISPATCH_SERVLET_CLASS) != null) {
+			dispatchServletClassName = config.getAttribute(DISPATCH_SERVLET_CLASS);
+		}
+		
+		mbeanServer = MBeanServerLocator.locateJBoss();
+		
+		//Get the jboss web domain name
+		try {
+			ObjectName queryEngineName = new ObjectName("*:type=Engine");
+			Set engines = mbeanServer.queryNames(queryEngineName, null);
+			if (engines.size() != 0) {
+				ObjectName engineName = (ObjectName) engines.iterator().next();
+				jbossWebDomain = engineName.getDomain();
+			} else {
+				jbossWebDomain = "jboss.web";
+			}
+		} catch (Exception e) {
+			jbossWebDomain = "jboss.web";
+		}
+		
+		//Check if the context already exists
+		try {
+			ObjectName contextName = new ObjectName(jbossWebDomain + ":host=" + host + ",path=" + httpContext + ",*");
+			Set contexts  = mbeanServer.queryNames(contextName, null);
+			if (contexts.size() > 0) {
+				throw new ConfigurationException("There is already an http context named " + httpContext + ", choose another one"); 
+			}
+		} catch (MalformedObjectNameException e) {
+			throw new ConfigurationException(e);
+		}
+		
+	}
+
+	/*
+	 * Start the Tomcat listner
+	 * 
+	 * @see org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle#doStart()
+	 */
+	protected void doStart() throws ManagedLifecycleException {
+
+		try {
+			startHttpServer();
+		} catch (Exception e) {
+			throw new ManagedLifecycleException(
+					"Failed to start Http gateway listener", e);
+		}
+		
+		try {
+			registerEndpoint();
+		} catch (Throwable t) {
+			logger.error("Unable to register service endpoint '" + endpointReference.getAddr().getAddress()
+                    + "' for service '" + serviceCategory + ":" + serviceName + "'.  Stopping Http Listener Server...", t);
+			try {
+				stopHttpServer();
+			} catch (Exception e) {
+				throw new ManagedLifecycleException(
+						"Failed to stop Http gateway listener", e);
+			}
+		} 
+	}
+
+	/*
+	 * Stop the tomcat listener
+	 * 
+	 * @see org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle#doStop()
+	 */
+	protected void doStop() throws ManagedLifecycleException {
+		unregisterEndpoint();
+		try {
+			stopHttpServer();
+		} catch (Exception e) {
+			throw new ManagedLifecycleException(
+					"Failed to stop Http gateway listener", e);
+		}
+		
+		
+	}
+
+	/*
+	 * Initialize the tomcat listener
+	 * 
+	 * @see org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle#doInitialise()
+	 */
+	protected void doInitialise() throws ManagedLifecycleException {
+		if (isInitialized()) {
+			throw new ManagedLifecycleException(
+					"Unexpected request to initialise JBoss Remoting Gateway listener '" + getConfig().getName() + "'.  Gateway already initialised.");
+		}
+
+	 	try {
+			endpointReference = new EPR(new URI("http://"+ host + ":" + port + this.httpContext));
+		} catch (Exception e) {
+			throw new ManagedLifecycleException(
+					"Remoting Listener configuration failed.", e);
+		}
+
+		initialized = true;
+	}
+
+	/*
+	 * Destory the tomcat listener
+	 * 
+	 * @see org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle#doDestroy()
+	 */
+	protected void doDestroy() throws ManagedLifecycleException {
+	}
+	
+	
+	
+	/**
+	 * Start the tomcat http server.It will firstly check if it really needs to create
+	 * Tomcat connector and host. Then add these new tomcat component to tomcat Engine 
+	 * tree through JMX server.
+	 * @throws Exception For error during start tomcat context
+	 */
+	@SuppressWarnings("unchecked")
+	protected void startHttpServer() throws Exception {		
+		
+		ObjectName standardHostName = new ObjectName(jbossWebDomain + ":host=" + host + ",type=Host");
+		ObjectName stardardEngineName = new ObjectName(jbossWebDomain + ":type=Engine");
+		ObjectName standardServiceName = new ObjectName(jbossWebDomain + ":serviceName=" + jbossWebDomain + ",type=Service");
+		ObjectName connectorName = new ObjectName(jbossWebDomain + ":*,port=" + port + ",type=Connector");
+		//Check if it needs to create host
+		Set hosts = mbeanServer.queryNames(standardHostName, null);
+		if (hosts.size() == 0) {
+			StandardHost newHost = new StandardHost();
+			newHost.setName(host);
+			mbeanServer.invoke(stardardEngineName, "addChild",
+					new Object[] { newHost }, new String[] { Container.class
+							.getName() });
+		    synchronized (hostReference) {
+				hostReference.put(host, 1);
+			}
+
+		} else {
+			updateReference(hostReference, host, 1);
+			
+		}
+		
+		// Check is it needs create connector
+		Set connectors = mbeanServer.queryNames(connectorName, null);
+		if (connectors.size() == 0) {
+			Connector connector = null;
+			connector = new Connector("org.apache.coyote.http11.Http11Protocol");
+			connector.setPort(Integer.parseInt(port));
+			mbeanServer.invoke(standardServiceName, "addConnector",
+					new Object[] { connector }, new String[] { Connector.class
+							.getName() });			
+		    synchronized (connectorReference) {
+				connectorReference.put(port, 1);
+			}
+
+		} else {
+			updateReference(connectorReference, port, 1);
+		}
+		
+        //Create context
+		ctx = new StandardContext();
+		ContextConfig ctxCfg = new ContextConfig();
+		ctx.addLifecycleListener(ctxCfg);
+		ctxCfg.setDefaultWebXml("org/apache/catalin/startup/NO_DEFAULT_XML");
+		ctx.setPath(httpContext);
+		ctx.setDocBase(".");
+		initWebappDefaults(ctx);
+		mbeanServer.invoke(standardHostName, "addChild", new Object[] { ctx }, new String[] { Container.class.getName() });
+
+	}
+
+    /**Register this endpoint
+     * @throws ConfigurationException For configuration error
+     * @throws RegistryException For registry error when register this EPR
+     */
+    private void registerEndpoint() throws ConfigurationException, RegistryException {
+        String serviceDescription = getConfig().getAttribute(ListenerTagNames.SERVICE_DESCRIPTION_TAG);
+        RegistryFactory.getRegistry().registerEPR(serviceCategory, serviceName, serviceDescription,
+                endpointReference, endpointReference.getAddr().getAddress());
+    }
+
+    /**Unregister this endpoint
+     */
+    private void unregisterEndpoint() {
+        try {
+            RegistryFactory.getRegistry().unRegisterEPR(serviceCategory, serviceName, endpointReference);
+        } catch (Throwable t) {
+            logger.error("Unable to unregister service endpoint '" + endpointReference.getAddr().getAddress()
+                    + "' for service '" + serviceCategory + ":" + serviceName + "'.", t);
+        }
+    }
+    
+	/**Stop tomcat server. It will destory the generated tomcat connector or host . 
+	 * Before do it , it will check if the reference count for it is zero .When there 
+	 * is no tomcat listner uses the generated host or connector, it will destory it 
+	 * @throws Exception For errors during stop tomcat connector or host
+	 */
+	public void stopHttpServer() throws Exception {
+		//Destroy the created context
+		ObjectName contextName = new ObjectName(jbossWebDomain + ":j2eeType=WebModule,name=//" + host + this.httpContext + ",*"); 
+		Set engines = mbeanServer.queryNames(contextName, null);
+		if (engines.isEmpty()) {
+			throw new InstanceNotFoundException("HttpContext:" + httpContext + "not found");
+		}
+		contextName = (ObjectName)engines.iterator().next();
+		mbeanServer.invoke(contextName, "destroy", new Object[] {}, new String[] {});
+		
+		//Decrese the host and connector reference
+		updateReference(hostReference, host, -1);
+		updateReference(connectorReference, port, -1);
+		
+		Object obj = hostReference.get(host);
+		
+		if (obj != null && (Integer)obj == 0) {
+			ObjectName standardHostName = new ObjectName(jbossWebDomain + ":host=" + host + ",type=Host");
+			try {
+				mbeanServer.invoke(standardHostName, "destroy", new Object[] {}, new String[] {});
+			} catch (InstanceNotFoundException e) {
+				logger.warn("Unable to destroy the Host " + standardHostName.getCanonicalName(), e);
+			} 			
+		}
+		
+		obj = connectorReference.get(port) ;
+		
+		if (obj != null && (Integer)obj == 0) {
+			ObjectName connectorName = new ObjectName(jbossWebDomain + ":port=" + port + ",type=Connector");
+			try {
+				mbeanServer.invoke(connectorName, "destroy", new Object[] {}, new String[] {});
+			} catch (InstanceNotFoundException e) {
+				//This is expected
+				logger.warn("Unable to destroy the Host " + connectorName.getCanonicalName(), e);
+
+			} 		
+		}
+	
+	}
+	
+	
+	/**If this listener initialized
+	 * @return true if initialized
+	 */
+	public boolean isInitialized() {
+		return initialized;
+	}
+
+	/**Get the uncomposed message delivery dapater
+	 * @return uncomposed message delivery adapter 
+	 * @throws ConfigurationException For configuation error 
+	 */
+	protected UncomposedMessageDeliveryAdapter createDeliveryAdapter()
+			throws ConfigurationException {
+		return UncomposedMessageDeliveryAdapter.getGatewayDeliveryAdapter(
+				getConfig(),
+				new TomcatMessageComposer<TomcatRequestWrapper>());
+	}
+
+	/**Initialize the StandardContext.By default it will uses 
+	 * {@link org.jboss.soa.esb.listeners.gateway.TomcatDefaultServlet} as default servlet mapping
+	 * @param ctx Created tomcat standard context
+	 * @throws Exception For errors during initialization
+	 */
+	protected void initWebappDefaults(StandardContext ctx) throws Exception {
+		StandardWrapper sw = (StandardWrapper) ctx.createWrapper();
+		sw.setServletClass(dispatchServletClassName);
+		sw.setName("default");
+		ctx.addChild(sw);
+		ctx.getServletContext().setAttribute("config", this.getConfig());
+
+		sw.addInitParameter("listings", "false");
+		sw.setLoadOnStartup(1);
+
+		try {
+			sw.start();
+		} catch (LifecycleException e) {
+			logger.error("Unexpected error when start the default servlet");
+			throw e;
+		}
+		ctx.addServletMapping("/", "default");
+	}
+	
+	/**Update the reference value
+	 * @param refrenceMap The reference map
+	 * @param key Update key
+	 * @param increment Update value
+	 */
+	@SuppressWarnings("unchecked")
+	public void updateReference(Map refrenceMap, String key , int increment) {
+		synchronized (refrenceMap) {
+			if (refrenceMap.get(key) != null) {
+				int count = (Integer) refrenceMap.get(key);
+				if (count == 0) {
+					return;
+				}
+				refrenceMap.put(key, count + increment);
+			}
+		}
+	}
+}

Added: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatMessageComposer.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatMessageComposer.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatMessageComposer.java	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,193 @@
+/*
+ * 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.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+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.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;
+/**
+ * TomcatMessageComposer 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 in ESB message properties with the key "RequestHeaderMap".
+ * <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 TomcatMessageComposer<T extends TomcatRequestWrapper>
+		extends AbstractMessageComposer<T> {
+	
+	/** Request header map key in esb message properties */
+	public static final String HTTP_REQUEST_HEADER_MAP = "RequestHeaderMap";
+	
+	/** Request parameter map key in esb message properties */
+	public static final String HTTP_REQUEST_PARAMETER_MAP = "RequestParameterMap";
+	
+	/** 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;
+
+	/* 
+	 * 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);
+	}
+
+	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 {
+		ServletRequest request = requestWrapper.getRequest();
+		Map paraMap = request.getParameterMap();
+		byte[] bodyBytes = null;
+		try {
+			InputStream ins = request.getInputStream();
+			bodyBytes = getBytes(ins);
+		} catch (IOException e) {
+			throw new MessageDeliverException(
+					"Failed to read body data from http request", e);
+		}
+		
+		message.getProperties().setProperty(HTTP_REQUEST_HEADER_MAP, getHeaderMap(request));
+		if (paraMap != null && paraMap.size() > 0) {
+		   message.getProperties().setProperty(this.HTTP_REQUEST_PARAMETER_MAP, paraMap);
+		}
+		payloadProxy.setPayload(message, bodyBytes);
+	}
+	
+	/* 
+	 * Method for decompsing a esb message to a HttpServletResponse
+	 */
+	@SuppressWarnings("unchecked")
+	public Object decompose(Message message, T requestWrapper) throws MessageDeliverException {
+        HttpServletResponse  httpResponse = (HttpServletResponse)requestWrapper.getResponse();
+        Object header = message.getProperties().getProperty(HTTP_RESPONSE_HEADER_MAP);
+        Object status = message.getProperties().getProperty(HTTP_RESPONSE_STATUS);
+        if (header != null) {
+        	Map headerMap = (Map)header;
+        	Iterator ite = headerMap.keySet().iterator();
+        	while (ite.hasNext()) {
+        		String name = (String)ite.next();
+        		String value = (String)headerMap.get(name);
+        		httpResponse.setHeader(name, value);
+        	}
+        	
+        }
+        if (status != null) {
+        	int reponseStatus = (Integer)status;
+        	httpResponse.setStatus(reponseStatus);	
+        }
+        
+		Object obj = payloadProxy.getPayload(message);
+		try {
+			if (obj instanceof String) {
+
+				requestWrapper.getResponse().getWriter().write((String) obj);
+
+			} else if (obj instanceof byte[]) {
+				requestWrapper.getResponse().getOutputStream().write(
+						(byte[]) obj);
+			} else {
+				throw new MessageDeliverException(
+						"Message payload is not byte array or String");
+			}
+		} catch (IOException e) {
+			throw new MessageDeliverException("Unexpected error when write the message to http response", e);
+		}
+		return requestWrapper.getResponse();
+	}
+
+	/**
+	 * Method for get http header map from a servlet request
+	 * @param request ServletRequest
+	 * @return HeaderMap
+	 */
+	@SuppressWarnings("unchecked")
+	public Map<String, Object> getHeaderMap(final ServletRequest request) {
+		Map headerMap = new java.util.HashMap<String, String>();
+		HttpServletRequest httpRequest = (HttpServletRequest) request;
+		Enumeration enumeration = httpRequest.getHeaderNames();
+		while (enumeration.hasMoreElements()) {
+			String name = (String) enumeration.nextElement();
+			String value = httpRequest.getHeader(name);
+			headerMap.put(name, value);
+		}
+
+		return headerMap;
+	}
+
+	/**
+	 * Method for reading the servlet request inputstream 
+	 * @param ins Servlet request InputStream
+	 * @return binary data
+	 * @throws IOException When error occured
+	 */
+	public byte[] getBytes(final InputStream ins) throws IOException {
+
+		byte[] bytes = new byte[2048];
+		int s = 0;
+		ByteArrayOutputStream bout = new ByteArrayOutputStream();
+		while ((s = ins.read(bytes)) != -1) {
+			bout.write(bytes, 0, s);
+		}
+		return bout.toByteArray();
+
+	}
+}

Added: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatRequestWrapper.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatRequestWrapper.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatRequestWrapper.java	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,46 @@
+/*
+ * 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 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 TomcatRequestWrapper {
+	private HttpServletRequest request = null;
+	private HttpServletResponse response = null;
+	public TomcatRequestWrapper(HttpServletRequest req, HttpServletResponse res) {
+		request = req;
+		response = res;
+	}
+	
+	public HttpServletRequest getRequest() {
+		return request;
+	}
+	
+	public HttpServletResponse getResponse() {
+		return response;
+	}
+}

Modified: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.java	2008-10-29 12:43:48 UTC (rev 23617)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.java	2008-10-29 14:36:09 UTC (rev 23618)
@@ -23,6 +23,7 @@
 import org.jboss.soa.esb.actions.AbstractActionLifecycle;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
 
 public class MyJMSListenerAction extends AbstractActionLifecycle
 {
@@ -34,9 +35,10 @@
   
   public Message displayMessage(Message message) throws Exception{
 		
-		  System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");		  		  
-		  System.out.println("Body: " + message.getBody().get()) ;
+		  System.out.println("&&&&&&&&&&&&& Service 1 &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");		  		  
+		  System.out.println("Header: " + message.getHeader().getCall().stringForm());
 		  System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+		  
 		  return message; 
         		
 	}

Modified: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java	2008-10-29 12:43:48 UTC (rev 23617)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java	2008-10-29 14:36:09 UTC (rev 23618)
@@ -52,7 +52,8 @@
 
     	esbMessage.getBody().add(args[2]);
     	
-        new ServiceInvoker(args[0], args[1]).deliverAsync(esbMessage);
+        Message msg = new ServiceInvoker(args[0], args[1]).deliverSync(esbMessage, 20000);
+        System.out.println("----" + msg.getBody().get());
     	
     }
     

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/build.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/build.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/build.xml	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,10 @@
+<project name="Quickstart_tomcat_listener" default="run" basedir=".">
+	
+	<description> 
+		${ant.project.name}
+		${line.separator}
+	</description>
+	
+	<!-- Import the base Ant build script... -->
+	<import file="../conf/base-build.xml"/> 	
+</project>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/deployment.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/deployment.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/deployment.xml	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,4 @@
+<jbossesb-deployment>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_Request_esb1</depends>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_Request_gw1</depends>
+</jbossesb-deployment>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbm-queue-service.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbm-queue-service.xml	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+	<depends>jboss.messaging:service=PostOffice</depends>
+  </mbean>
+  
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb_reply"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+	<depends>jboss.messaging:service=PostOffice</depends>
+  </mbean>
+</server>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbmq-queue-service.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbmq-queue-service.xml	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb">
+    <depends optional-attribute-name="DestinationManager">
+      jboss.mq:service=DestinationManager
+    </depends>
+  </mbean>
+  
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb_reply">
+    <depends optional-attribute-name="DestinationManager">
+      jboss.mq:service=DestinationManager
+    </depends>
+  </mbean>
+</server>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jboss-esb.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jboss-esb.xml	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,43 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
+
+    <providers>
+          <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
+              <jms-bus busid="quickstartEsbChannel">
+                  <jms-message-filter
+                      dest-type="QUEUE"
+                      dest-name="queue/quickstart_tomcatlistener_Request_esb"
+                  />
+              </jms-bus>
+          </jms-provider>
+          
+          
+         <tomcat-provider name="HTTP" host="localhost" port="8080">
+            <tomcat-bus busid="HTTP-1" context="/jbossesb/tomcat/listener" />
+         </tomcat-provider>
+      </providers>
+                      
+      <services>
+        <service 
+        	category="tomcatListener" 
+        	name="service" 
+        	description="Hello World">
+            <listeners>                
+                <tomcat-listener name="A1-HTTP"
+                    busidref="HTTP-1"
+                    maxThreads="1"
+                    is-gateway="true"/>	
+                <jms-listener name="JMS-Gateway"
+                	busidref="quickstartEsbChannel" 
+                	/>    
+            </listeners>
+            <actions mep="RequestResponse">
+                   <action name="action1" 
+                   	class="org.jboss.soa.esb.samples.quickstart.tomcatlistener.MyAction" 
+                   	process="displayMessage" 
+                   	/>                       
+            </actions>
+        </service>       
+      </services>
+     
+</jbossesb>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbossesb-properties.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbossesb-properties.xml	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  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.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+  These options are described in the JBossESB manual.
+  Defaults are provided here for convenience only.
+ 
+  Please read through this file prior to using the system, and consider
+  updating the specified entries.
+-->
+<esb
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+    <properties name="core">
+		<property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
+		<property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+		<property name="org.jboss.soa.esb.persistence.connection.factory" 	value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+        <property name="jboss.esb.invm.scope.default" value="NONE"/>
+    </properties>
+    <properties name="registry">      
+    	<property name="org.jboss.soa.esb.registry.queryManagerURI"     		
+    		value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>    		
+    	<property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"     		
+    		value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
+    	<property name="org.jboss.soa.esb.registry.implementationClass" 
+    		value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+    	<property name="org.jboss.soa.esb.registry.factoryClass" 
+    		value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+    	<property name="org.jboss.soa.esb.registry.user" 
+    		value="jbossesb"/>
+    	<property name="org.jboss.soa.esb.registry.password" 
+    	  value="password"/>
+    	<!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+    	<property name="org.jboss.soa.esb.scout.proxy.transportClass" 
+    		value="org.apache.ws.scout.transport.RMITransport"/>
+    </properties>
+    <properties name="transports" depends="core">
+    	<property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+    	<property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+    	<property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+    	<property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+    </properties>
+    <properties name="connection">
+    	<property name="min-pool-size" value="5"/>
+    	<property name="max-pool=size" value="10"/>
+    	<property name="blocking-timeout-millis" value="5000"/>
+    	<property name="abandoned-connection-timeout" value="10000"/>
+    	<property name="abandoned-connection-time-interval" value="30000"/>
+    </properties>
+    <properties name="dbstore">
+		<property name="org.jboss.soa.esb.persistence.db.connection.url" 	value="jdbc:hsqldb:hsql://localhost:9001/"/>
+		<property name="org.jboss.soa.esb.persistence.db.jdbc.driver" 		value="org.hsqldb.jdbcDriver"/>
+		<property name="org.jboss.soa.esb.persistence.db.user" 			value="sa"/>
+		<property name="org.jboss.soa.esb.persistence.db.pwd" 			value=""/>		
+		<property name="org.jboss.soa.esb.persistence.db.pool.initial.size"	value="2"/>
+		<property name="org.jboss.soa.esb.persistence.db.pool.min.size"	value="2"/>
+		<property name="org.jboss.soa.esb.persistence.db.pool.max.size"	value="5"/>
+		<!--table managed by pool to test for valid connections - created by pool automatically -->
+		<property name="org.jboss.soa.esb.persistence.db.pool.test.table"	value="pooltest"/>
+		<!-- # of milliseconds to timeout waiting for a connection from pool -->
+		<property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis"	value="5000"/> 
+                <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.StandaloneConnectionManager"/>
+    </properties>
+    <properties name="messagerouting">
+    	<property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
+    </properties>
+</esb>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jndi.properties
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jndi.properties	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jndi.properties	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,5 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+java.naming.factory.url.pkgs=org.jnp.interfaces
+

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/juddi.properties
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/juddi.properties	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/juddi.properties	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,69 @@
+# jUDDI Registry Properties (used by RegistryServer)
+# see http://www.juddi.org for more information
+
+# The UDDI Operator Name
+juddi.operatorName = jUDDI.org
+
+# The i18n locale default codes
+juddi.i18n.languageCode = en
+juddi.i18n.countryCode = US
+
+# The UDDI DiscoveryURL Prefix
+juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
+
+# The UDDI Operator Contact Email Address
+juddi.operatorEmailAddress = admin at juddi.org
+
+# The maximum name size and maximum number
+# of name elements allows in several of the
+# FindXxxx and SaveXxxx UDDI functions.
+juddi.maxNameLength=255
+juddi.maxNameElementsAllowed=5
+
+# The maximum number of UDDI artifacts allowed
+# per publisher. A value of '-1' indicates any 
+# number of artifacts is valid (These values can be
+# overridden at the individual publisher level).
+juddi.maxBusinessesPerPublisher=25
+juddi.maxServicesPerBusiness=20
+juddi.maxBindingsPerService=10
+juddi.maxTModelsPerPublisher=100
+
+# jUDDI Authentication module to use
+juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
+
+# jUDDI DataStore module currently to use
+juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
+
+# use a dataSource (if set to false a direct 
+# jdbc connection will be used.
+juddi.isUseDataSource=false
+juddi.jdbcDriver=com.mysql.jdbc.Driver
+juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
+juddi.jdbcUsername=root
+juddi.jdbcPassword=admin
+# jUDDI DataSource to use
+# juddi.dataSource=java:comp/env/jdbc/MySqlDS
+
+# jUDDI UUIDGen implementation to use
+juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
+
+# jUDDI Cryptor implementation to use
+juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
+ 
+# jUDDI Validator to use
+juddi.validator=org.apache.juddi.validator.DefaultValidator
+
+# jUDDI Proxy Properties (used by RegistryProxy)
+juddi.proxy.adminURL = http://localhost:8080/juddi/admin
+juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
+juddi.proxy.publishURL = http://localhost:8080/juddi/publish
+juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
+juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
+juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
+
+# JNDI settings (used by RMITransport)
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+  

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/log4j.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/log4j.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/log4j.xml	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <!-- ============================== -->
+   <!-- Append messages to the console -->
+   <!-- ============================== -->
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <!-- ================================= -->
+   <!-- Preserve messages in a local file -->
+   <!-- ================================= -->
+
+   <!-- A size based file rolling appender -->
+   <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+     <param name="File" value="./listener.log"/>
+     <param name="Append" value="false"/>
+     <param name="MaxFileSize" value="500KB"/>
+     <param name="MaxBackupIndex" value="1"/>
+
+     <layout class="org.apache.log4j.PatternLayout">
+       <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
+     </layout>	    
+   </appender>
+
+   <!-- ================ -->
+   <!-- Limit categories -->
+   <!-- ================ -->
+
+   <category name="org.jboss">
+      <priority value="WARN"/>
+   </category>
+   <category name="org.jboss.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.jboss.internal.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.apache">
+      <priority value="ERROR"/>
+   </category>
+   <category name="quickstart">
+      <priority value="DEBUG"/>
+   </category>
+   <!-- ======================= -->
+   <!-- Setup the Root category -->
+   <!-- ======================= -->
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+      <appender-ref ref="FILE"/>
+   </root>
+
+</log4j:configuration>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/readme.txt
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/readme.txt	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/readme.txt	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,17 @@
+Overview:
+=========
+  The purpose of the tomcat_listener quickstart sample is to demonstarte how to 
+  configue a tomcat listener to pass the http request into ESB service.
+  
+
+Running this quickstart:
+========================
+  Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
+  and a more detailed descripton of the different ways to run the quickstarts.
+
+To Run '.esb' archive mode:
+===========================
+  1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
+  2. Open the web brower and send http request to "http://localhost:8080/jbossesb/tomcat/listener"
+  3. Switch back to Application Server console to see the output from the ESB
+  4. In this folder ("Window1"), type 'ant undeploy'.

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/MyAction.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/MyAction.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/MyAction.java	2008-10-29 14:36:09 UTC (rev 23618)
@@ -0,0 +1,73 @@
+/*
+ * 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.tomcatlistener;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+public class MyAction extends AbstractActionLifecycle {
+
+	protected ConfigTree _config;
+
+	public MyAction(ConfigTree config) {
+		_config = config;
+	}
+
+	public Message displayMessage(Message message) throws Exception {
+
+		
+		System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+		
+		System.out.println("------------Http Header-------------------------"); 
+		Map<String, String> headerMap = (Map<String, String>)message.getProperties().getProperty("RequestHeaderMap");
+		Iterator<String> ite = headerMap.keySet().iterator();
+		while(ite.hasNext()) {
+			String key = ite.next();
+			System.out.println(key + " : " + headerMap.get(key));
+		}
+		
+		System.out.println("------------Http Prameter Map-------------------"); 
+		Object obj = message.getProperties().getProperty("RequestParameterMap");
+		
+		if (obj != null) {
+			Map<String, String> paraMap = (Map<String, String>)obj;
+			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(new String((byte[])message.getBody().get()));
+		
+		System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+		message.getBody().add("This message is from ESB service");
+		return message;
+
+	}
+
+}




More information about the jboss-svn-commits mailing list