geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r654807 - in /geronimo/server/trunk: plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/ testsuite/webservices-testsuite/jaxws-tests/jaxws-rest-war...
Date Fri, 09 May 2008 13:36:11 GMT
Author: gawor
Date: Fri May  9 06:36:11 2008
New Revision: 654807

URL: http://svn.apache.org/viewvc?rev=654807&view=rev
Log:
Handle HTTP GET invocations on Provider endpoints correctly (  GERONIMO-4008)

Modified:
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
    geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-rest-war/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSRestTest.java

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?rev=654807&r1=654806&r2=654807&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
(original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
Fri May  9 06:36:11 2008
@@ -32,6 +32,7 @@
 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;
@@ -327,28 +328,13 @@
             pw.flush();
         } else {            
             // REST request
-            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);
-
-            if (!processed.equals(InvocationResponse.CONTINUE)) {
-                response.setStatusCode(HttpURLConnection.HTTP_OK);
-                String s = HTTPTransportReceiver.getServicesHTML(configurationContext);
-                PrintWriter pw = new PrintWriter(response.getOutputStream());
-                pw.write(s);
-                pw.flush();
-            }            
+            processURLRequest(request, response, service, msgContext);            
         }
     }
+
+    protected void processPOSTRequest(Request request, Response response, AxisService service,
MessageContext msgContext) throws Exception {
+        processXMLRequest(request, response, service, msgContext);
+    }
     
     protected void setMsgContextProperties(Request request, Response response, AxisService
service, MessageContext msgContext) {
         msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream());
@@ -379,8 +365,11 @@
             msgContext.setProperty(JAXWSMessageReceiver.PARAM_BINDING, this.binding);  
         }
     }
-
-    protected void processPOSTRequest(Request request, Response response, AxisService service,
MessageContext msgContext) throws Exception {
+    
+    protected void processXMLRequest(Request request, 
+                                     Response response, 
+                                     AxisService service, 
+                                     MessageContext msgContext) throws Exception {
         String contentType = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
         String soapAction = request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
         if (soapAction == null) {
@@ -400,6 +389,35 @@
                                                   request.getURI().getPath());
     }
     
+    protected void processURLRequest(Request request,
+                                     Response response,
+                                     AxisService service,
+                                     MessageContext msgContext) throws Exception {
+        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);
+
+        if (!processed.equals(InvocationResponse.CONTINUE)) {
+            response.setStatusCode(HttpURLConnection.HTTP_OK);
+            String s = HTTPTransportReceiver.getServicesHTML(configurationContext);
+            PrintWriter pw = new PrintWriter(response.getOutputStream());
+            pw.write(s);
+            pw.flush();
+        }
+    }    
+    
     /*
      * Gets the right handlers for the port/service/bindings and performs injection.
      */

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java?rev=654807&r1=654806&r2=654807&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
(original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
Fri May  9 06:36:11 2008
@@ -17,25 +17,32 @@
 
 package org.apache.geronimo.axis2.pojo;
 
+import java.io.PrintWriter;
+import java.net.HttpURLConnection;
 import java.net.URL;
 
 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;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.Handler.InvocationResponse;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
 import org.apache.axis2.jaxws.server.endpoint.lifecycle.factory.EndpointLifecycleManagerFactory;
 import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.HTTPTransportReceiver;
 import org.apache.axis2.transport.http.HTTPTransportUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.axis2.transport.http.util.RESTUtil;
 import org.apache.geronimo.axis2.Axis2WebServiceContainer;
 import org.apache.geronimo.jaxws.JAXWSAnnotationProcessor;
 import org.apache.geronimo.jaxws.PortInfo;
 import org.apache.geronimo.jaxws.annotations.AnnotationHolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev$ $Date$
@@ -101,7 +108,10 @@
     }
     
     @Override
-    protected void processPOSTRequest(Request request, Response response, AxisService service,
MessageContext msgContext) throws Exception {
+    protected void processXMLRequest(Request request, 
+                                     Response response, 
+                                     AxisService service, 
+                                     MessageContext msgContext) throws Exception {
         String contentType = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
         String soapAction = request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
         if (soapAction == null) {
@@ -129,7 +139,47 @@
             POJOWebServiceContext.clear();
         } 
     }
-         
+        
+    @Override
+    protected void processURLRequest(Request request,
+                                     Response response,
+                                     AxisService service,
+                                     MessageContext msgContext) throws Exception {
+        ConfigurationContext configurationContext = msgContext.getConfigurationContext();
+        configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
+        
+        setMsgContextProperties(request, response, service, msgContext);
+        
+        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, 
+                                                   response.getOutputStream(),
+                                                   contentType);
+        } finally {                        
+            // de-associate JAX-WS MessageContext with the thread
+            // (association happens in POJOEndpointLifecycleManager.createService() call)
+            POJOWebServiceContext.clear();
+        }
+            
+        if (!processed.equals(InvocationResponse.CONTINUE)) {
+            response.setStatusCode(HttpURLConnection.HTTP_OK);
+            String s = HTTPTransportReceiver.getServicesHTML(configurationContext);
+            PrintWriter pw = new PrintWriter(response.getOutputStream());
+            pw.write(s);
+            pw.flush();
+        }
+    }
+    
     @Override
     public void destroy() {
         // call handler preDestroy

Modified: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-rest-war/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSRestTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-rest-war/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSRestTest.java?rev=654807&r1=654806&r2=654807&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-rest-war/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSRestTest.java
(original)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-rest-war/src/test/java/org/apache/geronimo/testsuite/testset/JaxWSRestTest.java
Fri May  9 06:36:11 2008
@@ -66,7 +66,7 @@
         }
     }
 
-    @Test
+    @Test(dependsOnMethods = {"testGET"})
     public void testPOST() throws Exception {
         String warName = System.getProperty("webAppName");
         assertNotNull("Web application name not specified", warName);



Mime
View raw message