cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r465184 - in /incubator/cxf/trunk: api/ rt/bindings/xml/src/main/resources/META-INF/ rt/bindings/xml/src/main/resources/META-INF/cxf/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws...
Date Wed, 18 Oct 2006 09:18:17 GMT
Author: ningjiang
Date: Wed Oct 18 02:18:15 2006
New Revision: 465184

URL: http://svn.apache.org/viewvc?view=rev&rev=465184
Log:
[JIRA CXF-104] PhaseOne:
Added ContextProperitesMapping for mapping cxf properties to jaxws properties and mapping
jaxws properties to cxf properties
Added HTTPBinding.HTTP_BINDING to xmlbinding namespace
Changed api.pom's CetliXfire to CXF
Update REST systest to using jax-ws properties name
Move out REST Provider Server for debuging


Added:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/Server.java
Modified:
    incubator/cxf/trunk/api/pom.xml
    incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/bus-extensions.xml
    incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointInvocationHandler.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java

Modified: incubator/cxf/trunk/api/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/pom.xml?view=diff&rev=465184&r1=465183&r2=465184
==============================================================================
--- incubator/cxf/trunk/api/pom.xml (original)
+++ incubator/cxf/trunk/api/pom.xml Wed Oct 18 02:18:15 2006
@@ -85,8 +85,8 @@
 		    <attach>true</attach>
 		    <quiet>true</quiet>
 		    <bottom>-</bottom>
-		    <header>CeltiXfire API</header>
-		    <footer>CeltiXfire API</footer>
+		    <header>CXF API</header>
+		    <footer>CXF API</footer>
 		    <sourcepath>${basedir}/src/main/java${path.separator}${basedir}/target/generated/src/main/java</sourcepath>
 		    <subpackages>org.apache.cxf</subpackages>
 		</configuration>

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/bus-extensions.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/bus-extensions.xml?view=diff&rev=465184&r1=465183&r2=465184
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/bus-extensions.xml (original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/bus-extensions.xml Wed
Oct 18 02:18:15 2006
@@ -20,11 +20,13 @@
 <extensions xmlns="http://cxf.apache.org/bus/extension">
 
     <extension class="org.apache.cxf.binding.xml.XMLBindingFactory" deferred="true">
-        <namespace>http://cxf.apache.org/bindings/xformat</namespace>       
+        <namespace>http://cxf.apache.org/bindings/xformat</namespace>
+        <namespace>http://www.w3.org/2004/08/wsdl/http</namespace>       
     </extension>
     
     <extension class="org.apache.cxf.binding.xml.XMLBindingInfoFactoryBean" deferred="true">
-        <namespace>http://cxf.apache.org/bindings/xformat</namespace>       
+        <namespace>http://cxf.apache.org/bindings/xformat</namespace>
+        <namespace>http://www.w3.org/2004/08/wsdl/http</namespace>        
     </extension>
     
 </extensions>

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension.xml?view=diff&rev=465184&r1=465183&r2=465184
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension.xml
(original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension.xml
Wed Oct 18 02:18:15 2006
@@ -28,6 +28,7 @@
         <property name="activationNamespaces">
             <set>
                 <value>http://cxf.apache.org/bindings/xformat</value>
+                <value>http://www.w3.org/2004/08/wsdl/http</value>
             </set>
         </property>
     </bean>
@@ -37,6 +38,7 @@
         <property name="activationNamespaces">
             <set>
                 <value>http://cxf.apache.org/bindings/xformat</value>
+                <value>http://www.w3.org/2004/08/wsdl/http</value>
             </set>
         </property>
     </bean>

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointInvocationHandler.java?view=diff&rev=465184&r1=465183&r2=465184
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointInvocationHandler.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointInvocationHandler.java
Wed Oct 18 02:18:15 2006
@@ -41,6 +41,7 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
 import org.apache.cxf.service.factory.MethodDispatcher;
 import org.apache.cxf.service.model.BindingOperationInfo;
 
@@ -82,17 +83,27 @@
         Map<String, Object> requestContext = this.getRequestContext();
         Map<String, Object> responseContext = this.getResponseContext();
         Map<String, Object> context = new HashMap<String, Object>();
+        
+        //need to do context mapping from jax-ws to cxf message
+        ContextPropertiesMapping.mapJaxws2Cxf(requestContext);
+        
         context.put(Client.REQUEST_CONTEXT, requestContext);
         context.put(Client.RESPONSE_CONTEXT, responseContext);
 
         requestContext.put(Method.class.getName(), method);
 
         boolean isAsync = method.getName().endsWith("Async");
+        
+        Object result = null;
         if (isAsync) {
-            return invokeAsync(method, oi, params, paramsWithOutHolder, context);
+            result = invokeAsync(method, oi, params, paramsWithOutHolder, context);
         } else {
-            return invokeSync(method, oi, params, paramsWithOutHolder, context);
+            result = invokeSync(method, oi, params, paramsWithOutHolder, context);
         }
+        // need to do context mapping from cxf message to jax-ws 
+        ContextPropertiesMapping.mapJaxws2Cxf(responseContext);
+        return result;
+        
     }
 
 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java?view=diff&rev=465184&r1=465183&r2=465184
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java
Wed Oct 18 02:18:15 2006
@@ -24,6 +24,8 @@
 import javax.xml.ws.WebServiceContext;
 import javax.xml.ws.handler.MessageContext;
 
+import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
+
 
 public class WebServiceContextImpl implements WebServiceContext {
 
@@ -51,6 +53,7 @@
     }
 
     public static void setMessageContext(MessageContext ctx) {
+        ContextPropertiesMapping.mapCxf2Jaxws(ctx);
         context.set(ctx);
     }
 

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java?view=auto&rev=465184
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
(added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
Wed Oct 18 02:18:15 2006
@@ -0,0 +1,91 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.jaxws.support;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.cxf.message.Message;
+
+// Do some context mapping work from rt-core to jaxws stander
+// NOTE if there some change in cxf Message property name, this class should be update
+
+public final class ContextPropertiesMapping {    
+    
+    private static Map<String, String> cxf2jaxwsMap = new HashMap<String, String>();
+    private static Map<String, String> jaxws2cxfMap = new HashMap<String, String>();
+    
+    static {
+        cxf2jaxwsMap.put(Message.ENDPOINT_ADDRESS, 
+                          BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+        cxf2jaxwsMap.put(Message.HTTP_REQUEST_METHOD,
+                          MessageContext.HTTP_REQUEST_METHOD);
+        cxf2jaxwsMap.put(Message.RESPONSE_CODE, 
+                          MessageContext.HTTP_RESPONSE_CODE);        
+        cxf2jaxwsMap.put(Message.PATH_INFO, 
+                          MessageContext.PATH_INFO);
+        cxf2jaxwsMap.put(Message.QUERY_STRING, 
+                          MessageContext.QUERY_STRING);
+        
+        jaxws2cxfMap.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
+                         Message.ENDPOINT_ADDRESS);
+        jaxws2cxfMap.put(MessageContext.HTTP_REQUEST_METHOD,
+                         Message.HTTP_REQUEST_METHOD);
+        jaxws2cxfMap.put(MessageContext.HTTP_RESPONSE_CODE,
+                         Message.RESPONSE_CODE);        
+        jaxws2cxfMap.put(MessageContext.PATH_INFO,
+                         Message.PATH_INFO);
+        jaxws2cxfMap.put(MessageContext.QUERY_STRING,
+                         Message.QUERY_STRING);
+        
+    }
+    
+    private ContextPropertiesMapping() {
+        
+    }
+    
+    private static void mapContext(Map<String, Object> context, Map<String, String>
map) {
+        Set<String> keyset = context.keySet();
+        String[] keys = new String[0];
+        keys = keyset.toArray(keys);
+        for (int i = 0; i < keys.length; i++) {
+            String key = keys[i];
+            String mappingString = map.get(key);
+            if (null != mappingString) {
+                Object obj = context.get(key);
+                context.put(mappingString, obj);
+            }
+        }
+    }
+    
+    
+    public static void mapJaxws2Cxf(Map<String, Object> context) {
+        mapContext(context, jaxws2cxfMap);
+    }
+    
+    public static void mapCxf2Jaxws(Map<String, Object> context) {
+        mapContext(context, cxf2jaxwsMap);
+    }
+   
+
+}

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java?view=auto&rev=465184
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java
(added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java
Wed Oct 18 02:18:15 2006
@@ -0,0 +1,73 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.jaxws.support;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.MessageContext;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.message.Message;
+
+public class ContextPropertiesMappingTest extends TestCase {
+    private static final String ADDRESS = "test address";
+    private static final String REQUEST_METHOD = "GET";
+    private Map<String, Object> message = new HashMap<String, Object>();
+    private Map<String, Object> requestContext = new HashMap<String, Object>();
+    private Map<String, Object> responseContext = new HashMap<String, Object>();
+    
+    
+    public void setUp() throws Exception {
+        message.clear();
+        message.put(Message.ENDPOINT_ADDRESS, ADDRESS);
+        message.put(Message.HTTP_REQUEST_METHOD, REQUEST_METHOD);
+        requestContext.clear();
+        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS + "jaxws");
+        responseContext.clear();
+    }
+    
+    public void testJaxws2Cxf() {
+        Object address = requestContext.get(Message.ENDPOINT_ADDRESS);
+        assertTrue("address should be null", address == null);
+        ContextPropertiesMapping.mapJaxws2Cxf(requestContext);
+        address = requestContext.get(Message.ENDPOINT_ADDRESS);
+        assertTrue("address should not be null", address != null);
+        assertEquals("address should get from requestContext", address, ADDRESS + "jaxws");
+        message.putAll(requestContext);
+        address = message.get(Message.ENDPOINT_ADDRESS);
+        address = requestContext.get(Message.ENDPOINT_ADDRESS);
+        assertTrue("address should not be null", address != null);
+        assertEquals("address should get from requestContext", address, ADDRESS + "jaxws");
       
+    }
+    
+    public void testCxf2Jaxws() {
+        responseContext.putAll(message);
+        Object requestMethod = responseContext.get(MessageContext.HTTP_REQUEST_METHOD);
+        assertTrue("requestMethod should be null", requestMethod == null);
+        ContextPropertiesMapping.mapCxf2Jaxws(responseContext);
+        requestMethod = responseContext.get(MessageContext.HTTP_REQUEST_METHOD);
+        assertTrue("requestMethod should not be null", requestMethod != null);
+        assertEquals(requestMethod, REQUEST_METHOD);
+    }
+    
+
+}

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ContextPropertiesMappingTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=diff&rev=465184&r1=465183&r2=465184
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Wed Oct 18 02:18:15 2006
@@ -180,6 +180,8 @@
             hc.setRequestMethod("POST");
         }
 
+        //TODO using Message context to deceided HTTP send properties
+        
         connection.setConnectTimeout((int)getClient().getConnectionTimeout());
         connection.setReadTimeout((int)getClient().getReceiveTimeout());
 

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java?view=diff&rev=465184&r1=465183&r2=465184
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java
Wed Oct 18 02:18:15 2006
@@ -21,7 +21,9 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
+import java.net.URI;
 import java.net.URL;
+import java.util.Map;
 import java.util.Properties;
 
 import javax.xml.namespace.QName;
@@ -31,10 +33,11 @@
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
-//import javax.xml.transform.stream.StreamSource;
 import javax.xml.ws.Dispatch;
-import javax.xml.ws.Endpoint;
+
 import javax.xml.ws.Service;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.http.HTTPBinding;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
@@ -45,7 +48,6 @@
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.systest.common.ClientServerSetupBase;
 import org.apache.cxf.systest.common.ClientServerTestBase;
-import org.apache.cxf.systest.common.TestServerBase;
 import org.apache.hello_world_xml_http.wrapped.XMLService;
 
 public class RestClientServerTest extends ClientServerTestBase {
@@ -55,27 +57,7 @@
     private final QName portName = new QName("http://apache.org/hello_world_xml_http/wrapped",
                                              "RestProviderPort");
 
-    public static class Server extends TestServerBase {
-
-        protected void run() {
-            Object implementor = new RestSourcePayloadProvider();
-            String address = "http://localhost:9023/XMLService/RestProviderPort/Customer";
-            Endpoint.publish(address, implementor);
-        }
-
-        public static void main(String[] args) {
-            try {
-                Server s = new Server();
-                s.start();
-            } catch (Exception ex) {
-                ex.printStackTrace();
-                System.exit(-1);
-            } finally {
-                System.out.println("done!");
-            }
-        }
-    }
-
+    
     public static Test suite() throws Exception {
         TestSuite suite = new TestSuite(RestClientServerTest.class);
         return new ClientServerSetupBase(suite) {
@@ -119,24 +101,31 @@
          */
     }
 
-    // Service.addPort() is not supported yet
-    /*
-     * public void testHttpGETDispatcher() throws Exception { String
-     * endpointAddress =
-     * "http://localhost:9023/XMLService/RestProviderPort/Customer"; Service
-     * service = Service.create(serviceName); URI endpointURI = new
-     * URI(endpointAddress.toString()); String path = null; String query = null;
-     * if (endpointURI != null){ path = endpointURI.getPath(); query =
-     * endpointURI.getQuery(); } service.addPort(portName,
-     * HTTPBinding.HTTP_BINDING, endpointAddress.toString()); Dispatch<Source>
-     * d = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
-     * Map<String, Object> requestContext = d.getRequestContext();
-     * requestContext.put(Message.HTTP_REQUEST_METHOD, new String("GET"));
-     * requestContext.put(Message.QUERY_STRING, "id=1"); //this is the original
-     * path part of uri requestContext.put(Message.PATH_INFO, path);
-     * System.out.println ("Invoking Restful GET Request with query string ");
-     * Source result = d.invoke(null); printSource(result); }
-     */
+   
+    public void utestHttpGETDispatcher() throws Exception { 
+        String endpointAddress =
+            "http://localhost:9023/XMLService/RestProviderPort/Customer"; 
+        Service service = Service.create(serviceName); 
+        URI endpointURI = new URI(endpointAddress.toString());
+        String path = null; 
+        //String query = null;
+        if (endpointURI != null) { 
+            path = endpointURI.getPath(); 
+            //query = endpointURI.getQuery();
+        } 
+        service.addPort(portName, HTTPBinding.HTTP_BINDING, endpointAddress.toString());
+        Dispatch<Source> d = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
+        Map<String, Object> requestContext = d.getRequestContext();
+        requestContext.put(MessageContext.HTTP_REQUEST_METHOD, new String("GET"));
+        requestContext.put(MessageContext.QUERY_STRING, "id=1"); 
+        //this is the original path part of uri 
+        requestContext.put(MessageContext.PATH_INFO, path);
+        System.out.println("Invoking Restful GET Request with query string ");
+        Source result = d.invoke(null);
+        assertNotNull("result shoud not be null", result);
+        printSource(result); 
+    }
+     
 
     void printSource(Source source) {
         try {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java?view=diff&rev=465184&r1=465183&r2=465184
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java
Wed Oct 18 02:18:15 2006
@@ -34,7 +34,7 @@
 
 import org.w3c.dom.Document;
 
-import org.apache.cxf.message.Message;
+
 
 @WebServiceProvider()
 @ServiceMode(value = Service.Mode.PAYLOAD)
@@ -49,15 +49,15 @@
 
     public DOMSource invoke(DOMSource request) {
         MessageContext mc = wsContext.getMessageContext();
-        String path = (String)mc.get(Message.PATH_INFO);
-        String query = (String)mc.get(Message.QUERY_STRING);
-        String httpMethod = (String)mc.get(Message.HTTP_REQUEST_METHOD);
-
-        /*
-         * System.out.println("--path--- " + path);
-         * System.out.println("--query--- " + query);
-         * System.out.println("--httpMethod--- " + httpMethod);
-         */
+        String path = (String)mc.get(MessageContext.PATH_INFO);
+        String query = (String)mc.get(MessageContext.QUERY_STRING);
+        String httpMethod = (String)mc.get(MessageContext.HTTP_REQUEST_METHOD);
+
+        
+//        System.out.println("--path--- " + path);
+//        System.out.println("--query--- " + query);
+//        System.out.println("--httpMethod--- " + httpMethod);
+        
         if (httpMethod.equalsIgnoreCase("POST")) {
             // TBD: parse query info from DOMSource
             // System.out.println("--POST: getAllCustomers--- ");
@@ -101,5 +101,6 @@
             e.printStackTrace();
         }
         return response;
-    }
+    }    
+   
 }

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/Server.java?view=auto&rev=465184
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/Server.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/Server.java Wed
Oct 18 02:18:15 2006
@@ -0,0 +1,46 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.systest.rest;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.systest.common.TestServerBase;
+
+public class Server extends TestServerBase {
+
+    protected void run() {
+        Object implementor = new RestSourcePayloadProvider();
+        String address = "http://localhost:9023/XMLService/RestProviderPort/Customer";
+        Endpoint.publish(address, implementor);
+    }        
+
+
+    public static void main(String[] args) {
+        try {
+            Server s = new Server();
+            s.start();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            System.exit(-1);
+        } finally {
+            System.out.println("done!");
+        }
+    }    
+}



Mime
View raw message