cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r614983 - in /incubator/cxf/trunk: rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ tools/wsdlto/test/src/te...
Date Thu, 24 Jan 2008 20:41:28 GMT
Author: dkulp
Date: Thu Jan 24 12:41:21 2008
New Revision: 614983

URL: http://svn.apache.org/viewvc?rev=614983&view=rev
Log:
[CXF-1404] Fix issues with parameterOrder causing problems with Bare mode
Add ServletContext to message for Jetty endpoints

Added:
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1404/
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1404/hello_world.wsdl
  (with props)
Modified:
    incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java
    incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java

Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?rev=614983&r1=614982&r2=614983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
(original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
Thu Jan 24 12:41:21 2008
@@ -27,6 +27,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -59,6 +60,7 @@
     protected JettyHTTPServerEngine engine;
     protected JettyHTTPTransportFactory transportFactory;
     protected JettyHTTPServerEngineFactory serverEngineFactory;
+    protected ServletContext servletContext;
     protected URL nurl;
     
     /**
@@ -93,6 +95,10 @@
         return LOG;
     }
     
+    public void setServletContext(ServletContext sc) {
+        servletContext = sc;
+    }
+    
     /**
      * Post-configure retreival of server engine.
      */
@@ -193,7 +199,16 @@
         return address;
     }
    
-    protected void doService(HttpServletRequest req, HttpServletResponse resp) throws IOException
{
+    protected void doService(HttpServletRequest req,
+                             HttpServletResponse resp) throws IOException {
+        doService(servletContext, req, resp);
+    }
+    protected void doService(ServletContext context,
+                             HttpServletRequest req,
+                             HttpServletResponse resp) throws IOException {
+        if (context == null) {
+            context = servletContext;
+        }
         Request baseRequest = (req instanceof Request) 
             ? (Request)req : HttpConnection.getCurrentConnection().getRequest();
             
@@ -240,13 +255,15 @@
         // REVISIT: service on executor if associated with endpoint
         try {
             BusFactory.setThreadDefaultBus(bus); 
-            serviceRequest(req, resp);
+            serviceRequest(context, req, resp);
         } finally {
             BusFactory.setThreadDefaultBus(null);  
         }    
     }
 
-    protected void serviceRequest(final HttpServletRequest req, final HttpServletResponse
resp)
+    protected void serviceRequest(final ServletContext context, 
+                                  final HttpServletRequest req, 
+                                  final HttpServletResponse resp)
         throws IOException {
         Request baseRequest = (req instanceof Request) 
             ? (Request)req : HttpConnection.getCurrentConnection().getRequest();
@@ -259,6 +276,7 @@
             inMessage.setContent(InputStream.class, req.getInputStream());
             inMessage.put(HTTP_REQUEST, req);
             inMessage.put(HTTP_RESPONSE, resp);
+            inMessage.put(HTTP_CONTEXT, context);
             inMessage.put(Message.HTTP_REQUEST_METHOD, req.getMethod());
             inMessage.put(Message.PATH_INFO, req.getContextPath() + req.getPathInfo());
             String normalizedEncoding = HttpHeaderHelper.mapCharset(req.getCharacterEncoding());

Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java?rev=614983&r1=614982&r2=614983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java
(original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPHandler.java
Thu Jan 24 12:41:21 2008
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 
+import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -29,12 +30,19 @@
     private String urlName;
     private boolean contextMatchExact;
     private JettyHTTPDestination jettyHTTPDestination;
+    private ServletContext servletContext;
     
     public JettyHTTPHandler(JettyHTTPDestination jhd, boolean cmExact) {
         contextMatchExact = cmExact;
         jettyHTTPDestination = jhd;
     }
     
+    public void setServletContext(ServletContext sc) {
+        servletContext = sc;
+        if (jettyHTTPDestination != null) {
+            jettyHTTPDestination.setServletContext(sc);
+        }
+    }
     public void setName(String name) {
         urlName = name;
     }
@@ -47,11 +55,11 @@
                        HttpServletResponse resp, int dispatch) throws IOException {     
  
         if (contextMatchExact) {
             if (target.equals(urlName)) {
-                jettyHTTPDestination.doService(req, resp);
+                jettyHTTPDestination.doService(servletContext, req, resp);
             }
         } else {
             if (target.startsWith(urlName)) {
-                jettyHTTPDestination.doService(req, resp);
+                jettyHTTPDestination.doService(servletContext, req, resp);
             }
         }
     }

Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java?rev=614983&r1=614982&r2=614983&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
(original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
Thu Jan 24 12:41:21 2008
@@ -29,6 +29,7 @@
 
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
+import javax.servlet.ServletContext;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
@@ -323,6 +324,9 @@
             context.addHandler(sessionHandler);           
         }
         contexts.addHandler(context);
+        
+        ServletContext sc = context.getServletContext();
+        handler.setServletContext(sc);
        
         final String smap = HttpUriMapper.getResourceBase(url.getPath());
         handler.setName(smap);

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java?rev=614983&r1=614982&r2=614983&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
Thu Jan 24 12:41:21 2008
@@ -595,30 +595,40 @@
             outputParts = outputMessage.getMessageParts();
         }
 
-        boolean partFound = false;
-
         while (params.hasNext()) {
             String param = params.next();
-            partFound = false;
+            MessagePartInfo inPart = null;
+            MessagePartInfo outPart = null;
             for (MessagePartInfo part : inputParts) {
                 if (param.equals(part.getName().getLocalPart())) {
-                    partFound = true;
+                    inPart = part;
                     break;
                 }
             }
-            // if not found, check output parts
-            if (!partFound) {
-                for (MessagePartInfo part : outputParts) {
-                    if (param.equals(part.getName().getLocalPart())) {
-                        partFound = true;
-                        break;
-                    }
+            //check output parts
+            for (MessagePartInfo part : outputParts) {
+                if (param.equals(part.getName().getLocalPart())) {
+                    outPart = part;
+                    break;
                 }
             }
-            if (!partFound) {
-                break;
+            if (inPart == null && outPart == null) {
+                return false;
+            } else if (inPart != null 
+                && outPart != null) {
+                if (inPart.isElement() != outPart.isElement()) {
+                    return false;
+                }
+                if (inPart.isElement()
+                    && !inPart.getElementQName().equals(outPart.getElementQName()))
{
+                    return false;
+                } else if (!inPart.isElement()
+                    && !inPart.getTypeQName().equals(outPart.getTypeQName())) {
+                    return false;                    
+                }
             }
+            
         }
-        return partFound;
+        return true;
     }
 }

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=614983&r1=614982&r2=614983&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Thu Jan 24 12:41:21 2008
@@ -55,10 +55,12 @@
 public class CodeGenTest extends ProcessorTestBase {
     private JAXWSContainer processor;
     private ClassLoader classLoader;
+    private String origCP;
 
     @Before
     public void setUp() throws Exception {
         super.setUp();
+        origCP = System.getProperty("java.class.path");
         File classFile = new java.io.File(output.getCanonicalPath() + "/classes");
         classFile.mkdir();
         System.setProperty("java.class.path", getClassPath() + classFile.getCanonicalPath()
@@ -77,6 +79,7 @@
     @After
     public void tearDown() {
         super.tearDown();
+        System.setProperty("java.class.path", origCP);
         processor = null;
         env = null;
     }
@@ -1204,5 +1207,13 @@
         
     }
     
-    
+    @Test
+    public void testWrapperWithWildcard()  throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf-1404/hello_world.wsdl"));
+        processor.setContext(env);
+        processor.execute();
+        Class sei =  classLoader.loadClass("org.apache.cxf.cxf1404.hello_world_soap_http.Greeter");
+        assertEquals(1, sei.getMethods().length);
+        assertFalse(Void.TYPE.equals(sei.getMethods()[0].getReturnType()));
+    }
 }

Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1404/hello_world.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1404/hello_world.wsdl?rev=614983&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1404/hello_world.wsdl
(added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1404/hello_world.wsdl
Thu Jan 24 12:41:21 2008
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:tns="http://cxf.apache.org/cxf1404/hello_world_soap_http"
+    xmlns:x1="http://cxf.apache.org/cxf1404/hello_world_soap_http/types"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://cxf.apache.org/cxf1404/hello_world_soap_http" name="HelloWorld">
+    <wsdl:types>
+        <schema targetNamespace="http://cxf.apache.org/cxf1404/hello_world_soap_http/types"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:x1="http://cxf.apache.org/cxf1404/hello_world_soap_http/types"
elementFormDefault="qualified">
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="string"/>
+                        <element name="requestTypeb" type="string"/>
+                        <element name="requestTypec" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <any/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="greetMeRequest">
+        <wsdl:part name="parameters" element="x1:greetMe"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeResponse">
+        <wsdl:part name="parameters" element="x1:greetMeResponse"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="Greeter">
+        <wsdl:operation name="greetMe" parameterOrder="parameters">
+            <wsdl:input name="greetMeRequest" message="tns:greetMeRequest"/>
+            <wsdl:output name="greetMeResponse" message="tns:greetMeResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="greetMe">
+            <soap:operation style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="SOAPService">
+        <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
+            <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+

Propchange: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1404/hello_world.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1404/hello_world.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1404/hello_world.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message