[jboss-svn-commits] JBL Code SVN: r29141 - in labs/jbossesb/workspace/tfennelly/httpg2/product: rosetta/src/org/jboss/soa/esb/listeners/config/mappers120 and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Sep 1 13:16:13 EDT 2009


Author: tfennelly
Date: 2009-09-01 13:16:12 -0400 (Tue, 01 Sep 2009)
New Revision: 29141

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/soa/esb/listeners/config/mappers120/HttpGatewayMapper.java
   labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.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/webservice_proxy_basic/jboss-esb.xml
Log:
more static async response

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-09-01 16:24:26 UTC (rev 29140)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/etc/schemas/xml/jbossesb-1.2.0.xsd	2009-09-01 17:16:12 UTC (rev 29141)
@@ -1813,15 +1813,15 @@
 		<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 minOccurs="0" maxOccurs="2">
+                        <xsd:element name="exception" type="jesb:httpExceptionMappings">
                             <xsd:annotation>
                                 <xsd:documentation xml:lang="en">
                                     Exception to HTTP status code mappings.
                                 </xsd:documentation>
                             </xsd:annotation>
                         </xsd:element>
-                        <xsd:element name="asyncResponse" type="jesb:asyncHttpResponse" minOccurs="0" maxOccurs="1">
+                        <xsd:element name="asyncResponse" type="jesb:asyncHttpResponse">
                             <xsd:annotation>
                                 <xsd:documentation xml:lang="en">
                                     Aynchronous HTTP Response.  If set, the gateway will asynchronously deliver the

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-09-01 16:24:26 UTC (rev 29140)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/HttpGatewayMapper.java	2009-09-01 17:16:12 UTC (rev 29141)
@@ -55,9 +55,9 @@
 
         String urlPattern = listener.getUrlPattern();
         PayloadAs.Enum payloadAs = listener.getPayloadAs();
-        AsyncHttpResponse asyncResponse = listener.getAsyncResponse();
 
-        if(asyncResponse != null) {
+        if(listener.getAsyncResponseList() != null && !listener.getAsyncResponseList().isEmpty()) {
+            AsyncHttpResponse asyncResponse = listener.getAsyncResponseList().get(0);
             listenerNode.setAttribute(HttpGatewayServlet.ASYNC_SERVICE_INVOKE, "true");
             listenerNode.setAttribute(HttpGatewayServlet.ASYNC_STATUS_CODE, Integer.toString(asyncResponse.getStatusCode()));
             AsyncHttpResponse.Payload payload = asyncResponse.getPayload();
@@ -165,11 +165,9 @@
             }
         }
 
-        if(listener != null) {
-            HttpExceptionMappings listenerExceptionConfig = listener.getException();
-            if(listenerExceptionConfig != null) {
-                buildExceptionMappingCSV(exceptionMappingsAttrBuilder, listenerExceptionConfig);
-            }
+        if(listener != null && listener.getExceptionList() != null && !listener.getExceptionList().isEmpty()) {
+            HttpExceptionMappings listenerExceptionConfig = listener.getExceptionList().get(0);
+            buildExceptionMappingCSV(exceptionMappingsAttrBuilder, listenerExceptionConfig);
         }
 
         if(exceptionMappingsAttrBuilder.length() > 0) {

Modified: 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/HttpGatewayServlet.java	2009-09-01 16:24:26 UTC (rev 29140)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpGatewayServlet.java	2009-09-01 17:16:12 UTC (rev 29141)
@@ -147,22 +147,24 @@
             } else {
                 serviceInvoker.deliverAsync(inMessage);
 
+                resp.setStatus(asyncStatusCode);
+
+                // Set the mep as a header on the response...
+                resp.setHeader(ASYNC_SERVICE_INVOKE, "true");
+
                 if(asyncPayload != null) {
-                    resp.getOutputStream().write(asyncPayload);
                     resp.setContentLength(asyncPayload.length);
                     resp.setContentType(asyncContentType);
                     if(asyncCharacterEncoding != null) {
                         resp.setCharacterEncoding(asyncCharacterEncoding);
                     }
+
+                    // Only write to the output after setting all headers etc...
+                    resp.getOutputStream().write(asyncPayload);
                 } else {
                     resp.setContentLength(0);
                 }
 
-                resp.setStatus(asyncStatusCode);
-
-                // Set the mep as a header on the response...
-                resp.setHeader(ASYNC_SERVICE_INVOKE, "true");
-
                 return;
             }
         } catch (MessageDeliverException e) {

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-09-01 16:24:26 UTC (rev 29140)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/build.xml	2009-09-01 17:16:12 UTC (rev 29141)
@@ -5,7 +5,7 @@
 		${line.separator}
 	</description>
 	
-    <property name="additional.deploys" value="http-exception-mappings.properties" />
+    <property name="additional.deploys" value="http-exception-mappings.properties,readme.txt" />
 
 	<!-- Import the base Ant build script... -->
 	<import file="../conf/base-build.xml"/> 	

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-09-01 16:24:26 UTC (rev 29140)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/http_gateway/jboss-esb.xml	2009-09-01 17:16:12 UTC (rev 29141)
@@ -47,6 +47,21 @@
             </actions>
         </service>
 
+        <service category="Async" name="List" description="" invmScope="GLOBAL">
+            <listeners>
+                <!-- Receives: http://<host>:<port>/Quickstart_http_gateway/http/Async/List
+                               Uses the default http bus configuration... -->
+                <http-gateway name="Async">
+                    <asyncResponse statusCode="202">
+                        <payload classpathResource="/readme.txt" contentType="text/plain" characterEncoding="UTF-8" />
+                    </asyncResponse>
+                </http-gateway>
+            </listeners>
+            <actions mep="RequestResponse">
+                <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyAction"/>
+            </actions>
+        </service>
+
         <service category="Exceptions" name="Exception1" description="" invmScope="GLOBAL">
             <listeners>
                 <http-gateway name="Exception2" />

Modified: labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/webservice_proxy_basic/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/webservice_proxy_basic/jboss-esb.xml	2009-09-01 16:24:26 UTC (rev 29140)
+++ labs/jbossesb/workspace/tfennelly/httpg2/product/samples/quickstarts/webservice_proxy_basic/jboss-esb.xml	2009-09-01 17:16:12 UTC (rev 29141)
@@ -5,7 +5,7 @@
 		<service category="Proxy_Basic" name="Proxy"
 				 description="Basic WebService Proxy"
 				 invmScope="GLOBAL" >
-			<listeners>                
+			<listeners>
                 <http-gateway name="basicProxy"/>
 			</listeners>
 			<actions mep="RequestResponse">



More information about the jboss-svn-commits mailing list