geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r658721 - in /geronimo/server/branches/2.0/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2: Axis2WebServiceContainer.java pojo/POJOWebServiceContainer.java
Date Wed, 21 May 2008 14:49:43 GMT
Author: gawor
Date: Wed May 21 07:49:43 2008
New Revision: 658721

URL: http://svn.apache.org/viewvc?rev=658721&view=rev
Log:
REST support updates and clean up some code

Modified:
    geronimo/server/branches/2.0/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
    geronimo/server/branches/2.0/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java

Modified: geronimo/server/branches/2.0/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?rev=658721&r1=658720&r2=658721&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
(original)
+++ geronimo/server/branches/2.0/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
Wed May 21 07:49:43 2008
@@ -32,7 +32,6 @@
 import javax.xml.ws.handler.Handler;
 
 import org.apache.axiom.om.util.UUIDGenerator;
-import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingHelper;
 import org.apache.axis2.addressing.EndpointReference;
@@ -364,6 +363,8 @@
         if (this.binding != null) {
             msgContext.setProperty(JAXWSMessageReceiver.PARAM_BINDING, this.binding);  
         }
+        
+        msgContext.setTo(new EndpointReference(request.getURI().toString()));
     }
     
     protected void processXMLRequest(Request request, 
@@ -381,30 +382,32 @@
 
         setMsgContextProperties(request, response, service, msgContext);
 
-        HTTPTransportUtils.processHTTPPostRequest(msgContext,
-                                                  request.getInputStream(), 
-                                                  response.getOutputStream(), 
-                                                  contentType, 
-                                                  soapAction, 
-                                                  request.getURI().getPath());
+        if (!HTTPTransportUtils.isRESTRequest(contentType)) {
+            HTTPTransportUtils.processHTTPPostRequest(msgContext,
+                                                      request.getInputStream(), 
+                                                      response.getOutputStream(), 
+                                                      contentType, 
+                                                      soapAction, 
+                                                      request.getURI().getPath());
+        } else {
+            RESTUtil.processXMLRequest(msgContext, 
+                                       request.getInputStream(),
+                                       response.getOutputStream(), 
+                                       contentType);
+        }
     }
     
     protected void processURLRequest(Request request,
                                      Response response,
                                      AxisService service,
                                      MessageContext msgContext) throws Exception {
+        String contentType = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+        
         ConfigurationContext configurationContext = msgContext.getConfigurationContext();
         configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
         
         setMsgContextProperties(request, response, service, msgContext);
-        
-        String contentType = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
-        
-        msgContext.setTo(new EndpointReference(request.getURI().toString()));
-        
-        msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream());
-        msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, new Axis2TransportInfo(response));
-
+                
         InvocationResponse processed = RESTUtil.processURLRequest(msgContext, 
                                                                   response.getOutputStream(),
                                                                   contentType);

Modified: geronimo/server/branches/2.0/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java?rev=658721&r1=658720&r2=658721&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
(original)
+++ geronimo/server/branches/2.0/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
Wed May 21 07:49:43 2008
@@ -24,8 +24,6 @@
 import javax.naming.Context;
 import javax.xml.ws.WebServiceException;
 
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
@@ -125,14 +123,21 @@
 
         ServiceContext serviceContext = msgContext.getServiceContext();
         serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, this.endpointInstance);
-
+                
         try {
-            HTTPTransportUtils.processHTTPPostRequest(msgContext,
-                                                      request.getInputStream(),
-                                                      response.getOutputStream(),
-                                                      contentType,
-                                                      soapAction,
-                                                      request.getURI().getPath());
+            if (!HTTPTransportUtils.isRESTRequest(contentType)) {
+                HTTPTransportUtils.processHTTPPostRequest(msgContext,
+                                                          request.getInputStream(),
+                                                          response.getOutputStream(),
+                                                          contentType,
+                                                          soapAction,
+                                                          request.getURI().getPath());
+            } else {
+                RESTUtil.processXMLRequest(msgContext, 
+                                           request.getInputStream(),
+                                           response.getOutputStream(), 
+                                           contentType);
+            }
         } finally {                        
             // de-associate JAX-WS MessageContext with the thread
             // (association happens in POJOEndpointLifecycleManager.createService() call)
@@ -145,6 +150,8 @@
                                      Response response,
                                      AxisService service,
                                      MessageContext msgContext) throws Exception {
+        String contentType = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+        
         ConfigurationContext configurationContext = msgContext.getConfigurationContext();
         configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
         
@@ -152,14 +159,7 @@
         
         ServiceContext serviceContext = msgContext.getServiceContext();
         serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, this.endpointInstance);
-        
-        String contentType = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
-        
-        msgContext.setTo(new EndpointReference(request.getURI().toString()));
-        
-        msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream());
-        msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, new Axis2TransportInfo(response));
-
+                
         InvocationResponse processed = null;
         try {
             processed = RESTUtil.processURLRequest(msgContext, 



Mime
View raw message