geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r581125 - in /geronimo/server/trunk/modules: geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ geronimo-cxf/src/main/java/org/apache/geronimo/cxf/
Date Tue, 02 Oct 2007 02:02:30 GMT
Author: gawor
Date: Mon Oct  1 19:02:29 2007
New Revision: 581125

URL: http://svn.apache.org/viewvc?rev=581125&view=rev
Log:
better handling of HTTP GET for JAX-WS web services (GERONIMO-3494)

Modified:
    geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
    geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
    geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java
    geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?rev=581125&r1=581124&r2=581125&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
Mon Oct  1 19:02:29 2007
@@ -34,6 +34,7 @@
 import org.apache.axiom.om.util.UUIDGenerator;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingHelper;
+import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
@@ -300,15 +301,27 @@
             } else {
                 service.printWSDL(response.getOutputStream());
             }
-        } else {
+        } else if (AxisServiceGenerator.isSOAP11(service)) {
+            response.setContentType("text/html");
+            PrintWriter pw = new PrintWriter(response.getOutputStream());
+            pw.write("<html><title>Web Service</title><body>");
+            pw.write("Hi, this is '" + service.getName() + "' web service.");
+            pw.write("</body></html>");
+            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(),
-                                                                      null);
+                                                                      contentType);
 
             if (!processed.equals(InvocationResponse.CONTINUE)) {
                 response.setStatusCode(HttpURLConnection.HTTP_OK);
@@ -316,7 +329,7 @@
                 PrintWriter pw = new PrintWriter(response.getOutputStream());
                 pw.write(s);
                 pw.flush();
-            }
+            }            
         }
     }
     

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java?rev=581125&r1=581124&r2=581125&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
Mon Oct  1 19:02:29 2007
@@ -307,5 +307,11 @@
         Parameter param = service.getParameter(EndpointDescription.AXIS_SERVICE_PARAMETER);
         return (param == null) ? null : (EndpointDescription) param.getValue();
     }
+    
+    public static boolean isSOAP11(AxisService service) {
+        EndpointDescription desc = AxisServiceGenerator.getEndpointDescription(service);
+        return javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING.equals(desc.getBindingType())
||
+               javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(desc.getBindingType());
+    }
          
 }

Modified: geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java?rev=581125&r1=581124&r2=581125&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java
(original)
+++ geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java
Mon Oct  1 19:02:29 2007
@@ -102,6 +102,11 @@
         return ((ServerImpl) getServer()).getEndpoint();
     }
 
+    public boolean isSOAP11() {
+       return SOAPBinding.SOAP11HTTP_BINDING.equals(implInfo.getBindingType()) ||
+              SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(implInfo.getBindingType());
+    }
+    
     public ServerImpl getServer() {
         return (ServerImpl) server;
     }

Modified: geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java?rev=581125&r1=581124&r2=581125&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
Mon Oct  1 19:02:29 2007
@@ -87,7 +87,7 @@
     protected void processGET(Request request, Response response) throws Exception {
         if (request.getParameter("xsd") != null || request.getParameter("XSD") != null) {
             getWsdl(request, response);
-        } else {
+        } else if (endpoint.isSOAP11()) {
             EndpointInfo ei = this.destination.getEndpointInfo();
             response.setContentType("text/html");
             PrintWriter pw = new PrintWriter(response.getOutputStream());
@@ -95,6 +95,8 @@
             pw.write("Hi, this is '" + ei.getService().getName().getLocalPart() + "' web
service.");
             pw.write("</body></html>");
             pw.flush();
+        } else {
+            processPOST(request, response);
         }
     }
     



Mime
View raw message