cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r471966 [1/2] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/endpoint/ api/src/main/java/org/apache/cxf/message/ api/src/main/java/org/apache/cxf/service/model/ common/common/src/main/java/org/apache/cxf/configuration/spring/ c...
Date Tue, 07 Nov 2006 02:06:31 GMT
Author: dandiep
Date: Mon Nov  6 18:06:28 2006
New Revision: 471966

URL: http://svn.apache.org/viewvc?view=rev&rev=471966
Log:
- Refactor servlet support to:
  - include a ServletController which can be delegated to
  - Handle multiple endpoints
  - handle a custom configuration location
- Added unit tests for servlet:
  - One which registered a service via the API
  - One which registered a service via cxf-servlet.xml
  - Onwe which had a pre-existing spring application context (this
    required explicit mention of which cxf-extension files we want)
- Renamed the cxf-extension files to cxf-extension-MODULE so spring
  users can selectively import. Also improved the BusApplicationContext
  so it could handle wild card imports.
- Fixed SOAP WSDL generation to include the <soap:body/>
- Allow overriding of the default content type for the HTTP binding.
  This is needed for JSON support. It'd be nice if we could extend
  this to SOAP as well...
- A servlet can't be a conduit initiator, so remove references to it
  being one.

Added:
    incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml
      - copied unchanged from r469641, incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension-xml.xml
      - copied unchanged from r469641, 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/servlet/ServletController.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-servlet.xml   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/AbstractServletTest.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/CXFServletTest.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/ExternalServicesServletTest.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/SpringServletTest.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/cxf-servlet.xml   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/spring.xml   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/web-external.xml   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/web-spring.xml   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/web.xml   (with props)
    incubator/cxf/trunk/rt/management/src/main/resources/META-INF/cxf/cxf-extension-management.xml
      - copied unchanged from r469641, incubator/cxf/trunk/rt/management/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml
      - copied, changed from r469641, incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/cxf-extension-jms.xml
      - copied unchanged from r469641, incubator/cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/rt/transports/local/src/main/resources/META-INF/DISCLAIMER   (with props)
    incubator/cxf/trunk/rt/transports/local/src/main/resources/META-INF/LICENSE   (with props)
    incubator/cxf/trunk/rt/transports/local/src/main/resources/META-INF/NOTICE   (with props)
    incubator/cxf/trunk/rt/transports/local/src/main/resources/META-INF/cxf/
    incubator/cxf/trunk/rt/transports/local/src/main/resources/META-INF/cxf/cxf-extension-local.xml   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml
      - copied unchanged from r471922, incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_doc_lit/
    incubator/cxf/trunk/testutils/src/main/java/org/apache/hello_world_doc_lit/GreeterImplDoc.java   (with props)
Removed:
    incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/rt/management/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension.xml
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Server.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/JaxbClassPathXmlApplicationContext.java
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanMap.java
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/ContentTypeOutInterceptor.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/DispatchInterceptor.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/URIParameterInterceptor.java
    incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingInfoFactoryBean.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapDestinationFactory.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AttachmentOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/pom.xml
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/CXFServlet.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletDestination.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletTransportFactory.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsServerFactoryBeanTest.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/bus/SpringBusFactoryTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Server.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Server.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Server.java Mon Nov  6 18:06:28 2006
@@ -19,9 +19,13 @@
 
 package org.apache.cxf.endpoint;
 
+import org.apache.cxf.transport.Destination;
+
 public interface Server  {
 
     void start();
     
     void stop();
+    
+    Destination getDestination();
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java Mon Nov  6 18:06:28 2006
@@ -49,6 +49,7 @@
     String SCHEMA_VALIDATION_ENABLED = Message.class.getCanonicalName() + ".schemaValidationEnabled";
     String CONTENT_TYPE = Message.class.getName() + ".ContentType";
     String BASE_PATH = Message.class.getName() + ".BASE_PATH";
+    String ENCODING = Message.class.getName() + ".ENCODING";
     String FIXED_PARAMETER_ORDER = Message.class.getName() + "FIXED_PARAMETER_ORDER";
 
     String getId();

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java Mon Nov  6 18:06:28 2006
@@ -129,6 +129,10 @@
             Endpoint ep = getExchange().get(Endpoint.class); 
             if (ep != null) {
                 val = ep.get(key);
+                
+                if (val == null) {
+                    val = ep.getEndpointInfo().getProperty(key);
+                }
             }
         }
         

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java Mon Nov  6 18:06:28 2006
@@ -22,11 +22,14 @@
 import javax.xml.namespace.QName;
 
 public class EndpointInfo extends AbstractPropertiesHolder {
-    final String transportId;
+    String transportId;
     ServiceInfo service;
     BindingInfo binding;
     QName name;
     String address;
+    
+    public EndpointInfo() {
+    }
     
     public EndpointInfo(ServiceInfo serv, String ns) {
         transportId = ns;

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/JaxbClassPathXmlApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/JaxbClassPathXmlApplicationContext.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/JaxbClassPathXmlApplicationContext.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/JaxbClassPathXmlApplicationContext.java Mon Nov  6 18:06:28 2006
@@ -32,6 +32,7 @@
 import org.apache.cxf.configuration.Configurer;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.Resource;
@@ -47,9 +48,14 @@
     public JaxbClassPathXmlApplicationContext(String location) throws BeansException {
         super(new String[]{location});
     }
-
+    
     public JaxbClassPathXmlApplicationContext(String[] locations) throws BeansException {
-        super(locations);
+        this(locations, null);
+    }
+    
+    public JaxbClassPathXmlApplicationContext(String[] locations, ApplicationContext parent) 
+        throws BeansException {
+        super(locations, parent);
         cfgFileLocations = locations;
     }
     

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanMap.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanMap.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanMap.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanMap.java Mon Nov  6 18:06:28 2006
@@ -73,7 +73,8 @@
                 continue;
             }
 
-            if (!type.isAssignableFrom(ctxt.getType(beanNames[i]))) {
+            Class beanType = ctxt.getType(beanNames[i]);
+            if (beanType == null || !type.isAssignableFrom(beanType)) {
                 continue;
             }
 

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Mon Nov  6 18:06:28 2006
@@ -613,7 +613,6 @@
      * @return
      */
     public static XMLStreamReader createXMLStreamReader(InputStream in) {
-
         try {
             return getXMLInputFactory().createXMLStreamReader(in);
         } catch (XMLStreamException e) {

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/ContentTypeOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/ContentTypeOutInterceptor.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/ContentTypeOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/ContentTypeOutInterceptor.java Mon Nov  6 18:06:28 2006
@@ -42,8 +42,12 @@
             headers = new HashMap<String, List<String>>();
             message.put(Message.PROTOCOL_HEADERS, headers);
         }
+        String ct = (String) message.getContextualProperty("Content-Type");
+        if (ct == null) {
+            ct = "application/xml";
+        }
         List<String> contentType = new ArrayList<String>();
-        contentType.add("application/xml");
+        contentType.add(ct);
         headers.put("Content-Type", contentType);
     }
 

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/DispatchInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/DispatchInterceptor.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/DispatchInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/DispatchInterceptor.java Mon Nov  6 18:06:28 2006
@@ -22,6 +22,7 @@
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
@@ -30,7 +31,7 @@
 import org.apache.cxf.service.model.BindingOperationInfo;
 
 public class DispatchInterceptor extends AbstractPhaseInterceptor<Message> {
-
+    public static final String RELATIVE_PATH = "relative.path";
     private static final Logger LOG = Logger.getLogger(DispatchInterceptor.class.getName());
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(DispatchInterceptor.class);
 
@@ -42,6 +43,24 @@
     public void handleMessage(Message message) {
         String path = (String)message.get(Message.PATH_INFO);
         String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
+        
+        String address = message.getExchange().get(Endpoint.class).getEndpointInfo().getAddress();
+        int idx = address.indexOf('/', 7);
+        if (idx != -1) {
+            address = address.substring(idx);
+        }
+        
+        if (path.startsWith(address)) {
+            path = path.substring(address.length());
+            if (!path.startsWith("/")) {
+                path = "/" + path;
+            }
+        }
+        
+        if (path.endsWith("/")) {
+            path = path.substring(0, path.length() - 1);
+        }
+        message.put(RELATIVE_PATH, path);
         LOG.info("Invoking " + method + " on " + path);
 
         URIMapper mapper = (URIMapper)message.getExchange().get(Service.class).get(URIMapper.class.getName());

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java Mon Nov  6 18:06:28 2006
@@ -18,8 +18,15 @@
  */
 package org.apache.cxf.binding.http;
 
+import java.util.Collection;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+import org.apache.cxf.Bus;
 import org.apache.cxf.binding.AbstractBindingFactory;
 import org.apache.cxf.binding.Binding;
+import org.apache.cxf.binding.BindingFactoryManager;
 import org.apache.cxf.binding.xml.XMLBinding;
 import org.apache.cxf.binding.xml.interceptor.XMLMessageOutInterceptor;
 import org.apache.cxf.interceptor.StaxOutInterceptor;
@@ -29,6 +36,31 @@
 public class HttpBindingFactory extends AbstractBindingFactory {
 
     public static final String HTTP_BINDING_ID = "http://apache.org/cxf/binding/http";
+    private Bus bus;
+    private Collection<String> activationNamespaces;    
+       
+    @Resource
+    public void setBus(Bus b) {
+        bus = b;
+    }
+    
+    @Resource
+    public void setActivationNamespaces(Collection<String> ans) {
+        activationNamespaces = ans;
+    }
+
+    @PostConstruct
+    void register() {
+        if (null == bus) {
+            return;
+        }
+        BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
+        if (null != bfm) {
+            for (String ns : activationNamespaces) {
+                bfm.registerBindingFactory(ns, this);
+            }
+        }
+    }
 
     public Binding createBinding(BindingInfo bi) {
         XMLBinding binding = new XMLBinding();

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/URIParameterInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/URIParameterInterceptor.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/URIParameterInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/URIParameterInterceptor.java Mon Nov  6 18:06:28 2006
@@ -24,6 +24,7 @@
 import java.util.ResourceBundle;
 import java.util.logging.Logger;
 
+import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.dom.DOMSource;
@@ -34,6 +35,7 @@
 import org.apache.cxf.binding.xml.interceptor.XMLMessageInInterceptor;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.StaxInInterceptor;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
@@ -54,7 +56,7 @@
     }
 
     public void handleMessage(Message message) {
-        String path = (String)message.get(Message.PATH_INFO);
+        String path = (String)message.get(DispatchInterceptor.RELATIVE_PATH);
         String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
         String contentType = (String)message.get(Message.CONTENT_TYPE);
 
@@ -103,8 +105,10 @@
         // incoming doc
         Document doc;
         if ("POST".equals(method) || "PUT".equals(method)) {
-            XMLStreamReader reader = StaxUtils.createXMLStreamReader(message.getContent(InputStream.class));
+            XMLInputFactory inputFactory = StaxInInterceptor.getXMLInputFactory(message);
             try {
+                XMLStreamReader reader = 
+                    inputFactory.createXMLStreamReader(message.getContent(InputStream.class));
                 doc = StaxUtils.read(reader);
             } catch (XMLStreamException e) {
                 throw new Fault(e);

Modified: incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java Mon Nov  6 18:06:28 2006
@@ -42,7 +42,7 @@
         sf.setServiceClass(CustomerService.class);
         sf.getServiceFactory().setWrapped(false);
         sf.setBindingFactory(new HttpBindingInfoFactoryBean());
-        sf.setAddress("http://localhost:9001/");
+        sf.setAddress("http://localhost:9001/foo/");
 
         Map<String, Object> props = new HashMap<String, Object>();
         props.put("contextMatchStrategy", "stem");
@@ -71,7 +71,7 @@
         
         // TEST POST/GETs
         
-        Document res = get("http://localhost:9001/customers");
+        Document res = get("http://localhost:9001/foo/customers");
         assertNotNull(res);
 
         addNamespace("c", "http://cxf.apache.org/jra");
@@ -79,7 +79,7 @@
         assertValid("/c:customers/c:customer/c:id[text()='123']", res);
         assertValid("/c:customers/c:customer/c:name[text()='Dan Diephouse']", res);
         
-        res = get("http://localhost:9001/customers/123");
+        res = get("http://localhost:9001/foo/customers/123");
         assertNotNull(res);
         
         addNamespace("c", "http://cxf.apache.org/jra");
@@ -87,18 +87,18 @@
         assertValid("/c:customer/c:id[text()='123']", res);
         assertValid("/c:customer/c:name[text()='Dan Diephouse']", res);
         
-        res = put("http://localhost:9001/customers/123", "update.xml");
+        res = put("http://localhost:9001/foo/customers/123", "update.xml");
         assertNotNull(res);
         
         assertValid("/c:updateCustomer", res);
         
-        res = post("http://localhost:9001/customers", "add.xml");
+        res = post("http://localhost:9001/foo/customers", "add.xml");
         assertNotNull(res);
         
         assertValid("/c:addCustomer", res);
 
         // Get the updated document
-        res = get("http://localhost:9001/customers/123");
+        res = get("http://localhost:9001/foo/customers/123");
         assertNotNull(res);
         
         assertValid("/c:customer", res);

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingInfoFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingInfoFactoryBean.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingInfoFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingInfoFactoryBean.java Mon Nov  6 18:06:28 2006
@@ -32,7 +32,7 @@
     private SoapVersion soapVersion = Soap11.getInstance();
     private String style = "document";
     private String use;
-    private String transportURI = "http://schemas.xmlsoap.org/wsdl/soap/http";
+    private String transportURI = "http://schemas.xmlsoap.org/soap/http";
     
     @Override
     public BindingInfo create() {

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapDestinationFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapDestinationFactory.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapDestinationFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapDestinationFactory.java Mon Nov  6 18:06:28 2006
@@ -29,6 +29,7 @@
 
 import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
 import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
+import com.ibm.wsdl.extensions.soap.SOAPBodyImpl;
 import com.ibm.wsdl.extensions.soap.SOAPOperationImpl;
 
 import org.apache.cxf.Bus;
@@ -97,6 +98,18 @@
             op.setStyle(soi.getStyle());
 
             b.addExtensor(op);
+            
+            if (b.getInput() != null) {
+                SOAPBodyImpl body = new SOAPBodyImpl();
+                body.setUse("literal");
+                b.getInput().addExtensor(body);
+            }
+            
+            if (b.getOutput() != null) {
+                SOAPBodyImpl body = new SOAPBodyImpl();
+                body.setUse("literal");
+                b.getOutput().addExtensor(body);
+            }
         }
     }
 

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AttachmentOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AttachmentOutInterceptor.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AttachmentOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AttachmentOutInterceptor.java Mon Nov  6 18:06:28 2006
@@ -36,7 +36,7 @@
 
 public class AttachmentOutInterceptor extends AbstractSoapInterceptor {
 
-    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(SoapOutInterceptor.class);
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AttachmentOutInterceptor.class);
 
     public AttachmentOutInterceptor() {
         super();

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java Mon Nov  6 18:06:28 2006
@@ -21,9 +21,8 @@
 
 import java.io.IOException;
 import java.net.MalformedURLException;
-import java.net.URL;
 import java.util.ArrayList;
-import java.util.Enumeration;
+import java.util.Collections;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -32,26 +31,33 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.configuration.spring.JaxbClassPathXmlApplicationContext;
+import org.springframework.context.ApplicationContext;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.UrlResource;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
 
 public class BusApplicationContext extends JaxbClassPathXmlApplicationContext {
     
     private static final String DEFAULT_CXF_CFG_FILE = "META-INF/cxf/cxf.xml";
-    private static final String DEFAULT_CXF_EXT_CFG_FILE = "META-INF/cxf/cxf-extension.xml";
-    private static final String CXF_PROPERTY_EDITORS_CFG_FILE = "META-INF/cxf/cxf-property-editors.xml";
+    private static final String DEFAULT_CXF_EXT_CFG_FILE = "classpath*:META-INF/cxf/cxf-extension-*.xml";
+    private static final String CXF_PROPERTY_EDITORS_CFG_FILE = 
+        "classpath*:META-INF/cxf/cxf-property-editors.xml";
     private static final Logger LOG = LogUtils.getL7dLogger(BusApplicationContext.class);
     
     private boolean includeDefaults;
     private String cfgFile;
     
     BusApplicationContext(String cf, boolean include) {
-        super((String[])null);
+        this(cf, include, null);
+    }
+
+    BusApplicationContext(String cf, boolean include, ApplicationContext parent) {
+        super((String[])null, parent);
         cfgFile = cf;
         includeDefaults = include;
     }
-
+    
     @Override
     protected Resource[] getConfigResources() {
   
@@ -59,24 +65,12 @@
        
         if (includeDefaults) {
             try {
-                Enumeration<URL> urls = Thread.currentThread().getContextClassLoader()
-                    .getResources(DEFAULT_CXF_CFG_FILE);
-                while (urls.hasMoreElements()) {
-                    resources.add(new UrlResource(urls.nextElement()));
-                }
-                
-                urls = Thread.currentThread().getContextClassLoader()
-                    .getResources(DEFAULT_CXF_EXT_CFG_FILE);
-                while (urls.hasMoreElements()) {
-                    resources.add(new UrlResource(urls.nextElement()));
-                } 
-                
-                urls = Thread.currentThread().getContextClassLoader()
-                    .getResources(CXF_PROPERTY_EDITORS_CFG_FILE);
-                while (urls.hasMoreElements()) {
-                    resources.add(new UrlResource(urls.nextElement()));
-                } 
+                PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(Thread
+                    .currentThread().getContextClassLoader());
                 
+                Collections.addAll(resources, resolver.getResources(DEFAULT_CXF_CFG_FILE));
+                Collections.addAll(resources, resolver.getResources(DEFAULT_CXF_EXT_CFG_FILE));
+                Collections.addAll(resources, resolver.getResources(CXF_PROPERTY_EDITORS_CFG_FILE));
             } catch (IOException ex) {
                 // ignore  
             }  

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java Mon Nov  6 18:06:28 2006
@@ -28,6 +28,7 @@
 import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.configuration.spring.ConfigurerImpl;
 import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
 
 public class SpringBusFactory implements BusFactory {
     
@@ -37,6 +38,17 @@
     
     private static Bus defaultBus;
 
+    private ApplicationContext context;
+
+    public SpringBusFactory() {
+        super();
+    }
+
+    public SpringBusFactory(ApplicationContext context) {
+        super();
+        this.context = context;
+    }
+    
     public synchronized Bus getDefaultBus() {
         if (null == defaultBus) {
             defaultBus = createBus();
@@ -53,14 +65,18 @@
     }
     
     public Bus createBus(String cfgFile) {
-        return createBus(cfgFile, true);
+        boolean includeDefaults = true;
+        if (context != null) {
+            includeDefaults = !context.containsBean("cxf");
+        }
+        
+        return createBus(cfgFile, includeDefaults);
     }
     
-    public Bus createBus(String cfgFile, boolean includeDefaults) {        
-
+    public Bus createBus(String cfgFile, boolean includeDefaults) {
         BusApplicationContext bac = null;
         try {      
-            bac = new BusApplicationContext(cfgFile, includeDefaults);           
+            bac = new BusApplicationContext(cfgFile, includeDefaults, context);           
         } catch (BeansException ex) {
             LogUtils.log(LOG, Level.WARNING, "APP_CONTEXT_CREATION_FAILED_MSG", ex, (Object[])null);
         }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java Mon Nov  6 18:06:28 2006
@@ -58,8 +58,8 @@
         InputStream is = message.getContent(InputStream.class);
         assert is != null;
 
-        // TODO: where does encoding constant go?
-        String encoding = (String)message.get("Encoding");
+        String encoding = (String)message.get(Message.ENCODING);
+        
         XMLStreamReader reader;
         try {
             reader = getXMLInputFactory(message).createXMLStreamReader(is, encoding);

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java Mon Nov  6 18:06:28 2006
@@ -56,7 +56,17 @@
         // assert os != null;
 
         // TODO: where does encoding constant go?
-        String encoding = (String)message.get("Encoding");
+        String encoding = (String)message.get(Message.ENCODING);
+        if (encoding == null && message.getExchange().getInMessage() != null) {
+            encoding = (String) message.getExchange().getInMessage().get(Message.ENCODING);
+            message.put(Message.ENCODING, encoding);
+        }
+        
+        if (encoding == null) {
+            encoding = "UTF-8";
+            message.put(Message.ENCODING, encoding);
+        }
+        
         XMLStreamWriter writer;
         try {
             writer = getXMLOutputFactory(message).createXMLStreamWriter(os, encoding);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/pom.xml?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/pom.xml (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/pom.xml Mon Nov  6 18:06:28 2006
@@ -43,6 +43,18 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>httpunit</groupId>
+            <artifactId>httpunit</artifactId>
+            <version>1.6.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>jtidy</groupId>
+            <artifactId>jtidy</artifactId>
+            <version>4aug2000r7-dev</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymockclassextension</artifactId>
             <scope>test</scope>
@@ -100,6 +112,12 @@
         <dependency>
             <groupId>javax.xml.soap</groupId>
             <artifactId>saaj-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <scope>test</scope>
+            <version>${spring.version}</version>
         </dependency>
     </dependencies>
     

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/CXFServlet.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/CXFServlet.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/CXFServlet.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/CXFServlet.java Mon Nov  6 18:06:28 2006
@@ -17,33 +17,21 @@
  * under the License.
  */
 
-
 package org.apache.cxf.jaxws.servlet;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.OutputStream;
 import java.lang.ref.WeakReference;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
 import java.util.Hashtable;
-import java.util.List;
 import java.util.Map;
-import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLWriter;
-import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
@@ -54,44 +42,42 @@
 import org.xml.sax.SAXException;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactoryHelper;
+import org.apache.cxf.BusException;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.jaxws.EndpointImpl;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.message.MessageImpl;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.tools.common.extensions.soap.SoapAddress;
-import org.apache.cxf.tools.util.SOAPBindingUtil;
+import org.apache.cxf.resource.URIResolver;
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.transport.DestinationFactoryManager;
-import org.apache.cxf.ws.addressing.EndpointReferenceType;
-import org.apache.cxf.wsdl.EndpointReferenceUtils;
-import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
-import org.xmlsoap.schemas.wsdl.http.AddressType;
-
+import org.springframework.context.ApplicationContext;
 
+/**
+ * A Servlet which supports loading of JAX-WS endpoints from an
+ * XML file and handling requests for endpoints created via other means
+ * such as Spring beans, or the Java API. All requests are passed on
+ * to the {@link ServletController}.
+ *
+ */
 public class CXFServlet extends HttpServlet {
-    
-    
-    static final String HTTP_REQUEST =
-        "HTTP_SERVLET_REQUEST";
-    static final String HTTP_RESPONSE =
-        "HTTP_SERVLET_RESPONSE";
-    
+
     static final Map<String, WeakReference<Bus>> BUS_MAP = new Hashtable<String, WeakReference<Bus>>();
     static final Logger LOG = Logger.getLogger(CXFServlet.class.getName());
     protected Bus bus;
-    protected Map<String, ServletDestination> servantMap 
-        = new HashMap<String, ServletDestination>();
-    
-    
-    EndpointReferenceType reference;
-    ServletTransportFactory servletTransportFactory;
-    EndpointImpl ep;
-    EndpointInfo ei;
-    
+
+    private ServletTransportFactory servletTransportFactory;
+    private ServletController controller;
+
+    public ServletController createServletController() {
+        return new ServletController(servletTransportFactory);
+    }
+
+    public ServletController getController() {
+        return controller;
+    }
+
     public void init(ServletConfig servletConfig) throws ServletException {
         super.init(servletConfig);
-        
+
         String busid = servletConfig.getInitParameter("bus.id");
         if (null != busid) {
             WeakReference<Bus> ref = BUS_MAP.get(busid);
@@ -100,26 +86,59 @@
             }
         }
         if (null == bus) {
-            bus = BusFactoryHelper.newInstance().createBus();
+            // try to pull an existing ApplicationContext out of the
+            // ServletContext
+            ServletContext svCtx = getServletContext();
+            ApplicationContext ctx = (ApplicationContext)svCtx
+                .getAttribute("interface org.springframework.web.context.WebApplicationContext.ROOT");
+
+            // This constructor works whether there is a context or not
+            bus = new SpringBusFactory(ctx).getDefaultBus();
         }
         if (null != busid) {
             BUS_MAP.put(busid, new WeakReference<Bus>(bus));
         }
 
-        InputStream ins = servletConfig.getServletContext()
-            .getResourceAsStream("/WEB-INF/cxf-servlet.xml");
+        replaceDestionFactory();
+
+        // Set up the servlet as the default server side destination factory
+        controller = createServletController();
+
+        // build endpoints from the web.xml or a config file
+        buildEndpoints(servletConfig);
+    }
+
+    protected void buildEndpoints(ServletConfig servletConfig) throws ServletException {
+        String location = servletConfig.getInitParameter("config-location");
+        if (location == null) {
+            location = "/WEB-INF/cxf-servlet.xml";
+        }
+        InputStream ins = servletConfig.getServletContext().getResourceAsStream(location);
+
+        if (ins == null) {
+            try {
+                URIResolver resolver = new URIResolver(location);
+
+                if (resolver.isResolved()) {
+                    ins = resolver.getInputStream();
+                }
+            } catch (IOException e) {
+                // ignore
+            }
+
+        }
+
         if (ins != null) {
             DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
             builderFactory.setNamespaceAware(true);
             builderFactory.setValidating(false);
-            
-            
+
             try {
                 Document doc = builderFactory.newDocumentBuilder().parse(ins);
                 Node nd = doc.getDocumentElement().getFirstChild();
                 while (nd != null) {
                     if ("endpoint".equals(nd.getLocalName())) {
-                        loadEndpoint(servletConfig, nd);
+                        buildEndpoint(servletConfig, nd);
                     }
                     nd = nd.getNextSibling();
                 }
@@ -133,88 +152,88 @@
         }
     }
 
-    private void deregisterTransport(String transportId) {
-        bus.getExtension(DestinationFactoryManager.class).deregisterDestinationFactory(transportId);        
-    }
-
     /**
      * @return
      */
     protected DestinationFactory createServletTransportFactory() {
         if (servletTransportFactory == null) {
-            servletTransportFactory = new ServletTransportFactory(bus, reference);
+            servletTransportFactory = new ServletTransportFactory(bus);
         }
         return servletTransportFactory;
     }
 
     private void registerTransport(DestinationFactory factory, String namespace) {
-        bus.getExtension(DestinationFactoryManager.class).registerDestinationFactory(
-                                                                  namespace,
-                                                                  factory);
+        bus.getExtension(DestinationFactoryManager.class).registerDestinationFactory(namespace, factory);
+    }
+
+    public void buildEndpoint(ServletConfig servletConfig, Node node) throws ServletException {
+        Element el = (Element)node;
+        String implName = el.getAttribute("implementation");
+        String serviceName = el.getAttribute("service");
+        String wsdlName = el.getAttribute("wsdl");
+        String portName = el.getAttribute("port");
+        String urlPat = el.getAttribute("url-pattern");
+
+        buildEndpoint(implName, serviceName, wsdlName, portName, urlPat);
     }
 
-    public void loadEndpoint(String implName,
-                             String serviceName,
-                             String wsdlName,
-                             String portName,
-                             String urlPat) throws ServletException {
+    public void buildEndpoint(String implName, String serviceName, String wsdlName, String portName,
+                              String urlPat) throws ServletException {
 
         try {
-            
-            URL url = null;
-            if (wsdlName != null) {
-                try {
-                    url = getServletConfig().getServletContext().getResource(wsdlName);
-                } catch (MalformedURLException ex) {
-                    try {
-                        url = new URL(wsdlName);
-                    } catch (MalformedURLException ex2) {
-                        try {
-                            url = getServletConfig().getServletContext().getResource("/" + wsdlName);
-                        } catch (MalformedURLException ex3) {
-                            url = null;
-                        }
-                    }
-                }
-            }
-            Class cls = Class.forName(implName, false, Thread.currentThread().getContextClassLoader());
+
+            // TODO: This wasn't doing anything before. We need to pass this to
+            // the
+            // EndpointImpl so the service factory can use it...
+            // URL url = null;
+            // if (wsdlName != null && wsdlName.length() > 0) {
+            // try {
+            // url =
+            // getServletConfig().getServletContext().getResource(wsdlName);
+            // } catch (MalformedURLException ex) {
+            // try {
+            // url = new URL(wsdlName);
+            // } catch (MalformedURLException ex2) {
+            // try {
+            // url = getServletConfig().getServletContext().getResource("/" +
+            // wsdlName);
+            // } catch (MalformedURLException ex3) {
+            // url = null;
+            // }
+            // }
+            // }
+            // }
+            Class cls = ClassLoaderUtils.loadClass(implName, getClass());
             Object impl = cls.newInstance();
-            reference = EndpointReferenceUtils
-                    .getEndpointReference(url,
-                                      QName.valueOf(serviceName),
-                                      portName);
-            
-
-            
-            ep = new EndpointImpl(bus, impl, url.toString());
-            replaceDestionFactory();
-//          doesn't really matter what URL is used here
-            ep.publish("http://localhost" + (urlPat.charAt(0) == '/' ? "" : "/") + urlPat);
-            
-            ei = ep.getServer().getEndpoint().getEndpointInfo();
-            
-            
 
+            EndpointImpl ep = new EndpointImpl(bus, impl, (String)null);
+
+            // doesn't really matter what URL is used here
+            ep.publish("http://localhost" + (urlPat.charAt(0) == '/' ? "" : "/") + urlPat);
         } catch (ClassNotFoundException ex) {
             throw new ServletException(ex);
         } catch (InstantiationException ex) {
             throw new ServletException(ex);
         } catch (IllegalAccessException ex) {
             throw new ServletException(ex);
-        }    
+        }
     }
 
-    private void replaceDestionFactory() {
+    private void replaceDestionFactory() throws ServletException {
+        DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+        try {
+            DestinationFactory df = dfm
+                .getDestinationFactory("http://cxf.apache.org/transports/http/configuration");
+            if (df instanceof ServletTransportFactory) {
+                servletTransportFactory = (ServletTransportFactory)df;
+                return;
+            }
+        } catch (BusException e) {
+            // why are we throwing a busexception if the DF isn't found?
+        }
+
         DestinationFactory factory = createServletTransportFactory();
-        
 
-        deregisterTransport("http://schemas.xmlsoap.org/wsdl/soap/http");
-        deregisterTransport("http://schemas.xmlsoap.org/soap/http");
-        deregisterTransport("http://www.w3.org/2003/05/soap/bindings/HTTP/");
-        deregisterTransport("http://schemas.xmlsoap.org/wsdl/http/");
-        deregisterTransport("http://cxf.apache.org/transports/http/configuration");
-        deregisterTransport("http://cxf.apache.org/bindings/xformat");
-        
         registerTransport(factory, "http://schemas.xmlsoap.org/wsdl/soap/http");
         registerTransport(factory, "http://schemas.xmlsoap.org/soap/http");
         registerTransport(factory, "http://www.w3.org/2003/05/soap/bindings/HTTP/");
@@ -223,85 +242,30 @@
         registerTransport(factory, "http://cxf.apache.org/bindings/xformat");
     }
 
-    public void loadEndpoint(ServletConfig servletConfig, Node node) 
-        throws ServletException {
-        Element el = (Element)node;
-        String implName = el.getAttribute("implementation");
-        String serviceName = el.getAttribute("service");
-        String wsdlName = el.getAttribute("wsdl");
-        String portName = el.getAttribute("port");
-        String urlPat = el.getAttribute("url-pattern");
-        
-        loadEndpoint(implName, serviceName, wsdlName, portName, urlPat);
-    }
-
     public void destroy() {
         String s = bus.getId();
         BUS_MAP.remove(s);
-        
+
         bus.shutdown(true);
     }
-    
-    void addServant(URL url, ServletDestination servant) {
-        servantMap.put(url.getPath(), servant);
-    }
-    void removeServant(URL url, ServletDestination servant) {
-        servantMap.remove(url.getPath());
-    }
-    
+
     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
-        try {
-            if (LOG.isLoggable(Level.INFO)) {
-                LOG.info("Service http request on thread: " + Thread.currentThread());
-            }
-            
-            MessageImpl inMessage = new MessageImpl();
-            inMessage.setContent(InputStream.class, request.getInputStream());
-            inMessage.put(HTTP_REQUEST, request);
-            inMessage.put(HTTP_RESPONSE, response);
-            inMessage.put(Message.HTTP_REQUEST_METHOD, request.getMethod());
-            inMessage.put(Message.PATH_INFO, request.getPathInfo());
-            inMessage.put(Message.QUERY_STRING, request.getQueryString());
-            
-            ((ServletDestination)ep.getServer().getDestination()).doMessage(inMessage);
-        } catch (IOException e) {
-            throw new ServletException(e);
-        }
-      
+        controller.invoke(request, response);
     }
 
     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException {
-        try {
-            
-            
-            response.setHeader("Content-Type", "text/xml");
-            
-            OutputStream os = response.getOutputStream();
-            
-            WSDLWriter wsdlWriter = WSDLFactory.newInstance().newWSDLWriter();
-            Definition def = new ServiceWSDLBuilder(ei.getService()).build();
-            Port port = def.getService(ei.getService().getName()).getPort(
-                                       ei.getName().getLocalPart());
-            List<?> exts = port.getExtensibilityElements();
-            if (exts.size() > 0) {
-                ExtensibilityElement el = (ExtensibilityElement)exts.get(0);
-                if (SOAPBindingUtil.isSOAPAddress(el)) {
-                    SoapAddress add = SOAPBindingUtil.getSoapAddress(el);
-                    add.setLocationURI(request.getRequestURL().toString());
-                }
-                if (el instanceof AddressType) {
-                    AddressType add = (AddressType)el;
-                    add.setLocation(request.getRequestURL().toString());
-                }
-            }
-            
-            wsdlWriter.writeWSDL(def, os);
-            response.getOutputStream().flush();
-            return;
-        } catch (Exception ex) {
-            
-            throw new ServletException(ex);
-        }
+        controller.invoke(request, response);
+    }
+
+    @Override
+    protected void doDelete(HttpServletRequest request, HttpServletResponse response)
+        throws ServletException, IOException {
+        controller.invoke(request, response);
     }
 
+    @Override
+    protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException,
+        IOException {
+        controller.invoke(request, response);
+    }
 }

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletController.java?view=auto&rev=471966
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletController.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletController.java Mon Nov  6 18:06:28 2006
@@ -0,0 +1,146 @@
+/**
+ * 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.servlet;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLWriter;
+
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.tools.common.extensions.soap.SoapAddress;
+import org.apache.cxf.tools.util.SOAPBindingUtil;
+import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
+import org.xmlsoap.schemas.wsdl.http.AddressType;
+
+public class ServletController {
+
+    static final String HTTP_REQUEST = "HTTP_SERVLET_REQUEST";
+    static final String HTTP_RESPONSE = "HTTP_SERVLET_RESPONSE";
+
+    private static final Logger LOG = Logger.getLogger(ServletController.class.getName());
+
+    private ServletTransportFactory transport;
+
+    public ServletController(ServletTransportFactory df) {
+        this.transport = df;
+    }
+
+    public void invoke(HttpServletRequest request, HttpServletResponse res) throws ServletException {
+        boolean wsdl = false;
+        if (request.getQueryString() != null && request.getQueryString().trim().equalsIgnoreCase("wsdl")) {
+            wsdl = true;
+        }
+
+        try {
+            EndpointInfo ei = new EndpointInfo();
+            ei.setAddress("http://localhost" + request.getServletPath() + request.getPathInfo());
+            ServletDestination d = (ServletDestination)transport.getDestination(ei);
+
+            if (d.getMessageObserver() == null) {
+                generateNotFound(request, res);
+            } else if (wsdl) {
+                generateWSDL(request, res, d);
+            } else {
+                invokeDestination(request, res, d);
+            }
+        } catch (IOException e) {
+            throw new ServletException(e);
+        }
+    }
+
+    protected void generateNotFound(HttpServletRequest request, HttpServletResponse res) throws IOException {
+        res.setStatus(404);
+        res.setContentType("text/html");
+        res.getWriter().write("<html><body>No service was found.</body></html>");
+    }
+
+    public void invokeDestination(HttpServletRequest request, HttpServletResponse response,
+                                  ServletDestination d) throws ServletException {
+        if (LOG.isLoggable(Level.INFO)) {
+            LOG.info("Service http request on thread: " + Thread.currentThread());
+        }
+
+        try {
+            MessageImpl inMessage = new MessageImpl();
+            inMessage.setContent(InputStream.class, request.getInputStream());
+            inMessage.put(HTTP_REQUEST, request);
+            inMessage.put(HTTP_RESPONSE, response);
+            inMessage.put(Message.HTTP_REQUEST_METHOD, request.getMethod());
+            inMessage.put(Message.PATH_INFO, request.getPathInfo());
+            inMessage.put(Message.QUERY_STRING, request.getQueryString());
+            inMessage.put(Message.CONTENT_TYPE, request.getContentType());
+            inMessage.put(Message.ENCODING, request.getCharacterEncoding());
+
+            d.doMessage(inMessage);
+        } catch (IOException e) {
+            throw new ServletException(e);
+        }
+
+    }
+
+    protected void generateWSDL(HttpServletRequest request, 
+                                HttpServletResponse response, 
+                                ServletDestination d)
+        throws ServletException {
+        response.setHeader("Content-Type", "text/xml");
+
+        try {
+            OutputStream os = response.getOutputStream();
+
+            WSDLWriter wsdlWriter = WSDLFactory.newInstance().newWSDLWriter();
+            EndpointInfo ei = d.getEndpointInfo();
+            Definition def = new ServiceWSDLBuilder(ei.getService()).build();
+            Port port = def.getService(ei.getService().getName()).getPort(ei.getName().getLocalPart());
+            List<?> exts = port.getExtensibilityElements();
+            if (exts.size() > 0) {
+                ExtensibilityElement el = (ExtensibilityElement)exts.get(0);
+                if (SOAPBindingUtil.isSOAPAddress(el)) {
+                    SoapAddress add = SOAPBindingUtil.getSoapAddress(el);
+                    add.setLocationURI(request.getRequestURL().toString());
+                }
+                if (el instanceof AddressType) {
+                    AddressType add = (AddressType)el;
+                    add.setLocation(request.getRequestURL().toString());
+                }
+            }
+
+            wsdlWriter.writeWSDL(def, os);
+            response.getOutputStream().flush();
+        } catch (WSDLException e) {
+            throw new ServletException(e);
+        } catch (IOException e) {
+            throw new ServletException(e);
+        }
+    }
+}

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletController.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletController.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletDestination.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletDestination.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletDestination.java Mon Nov  6 18:06:28 2006
@@ -17,14 +17,8 @@
  * under the License.
  */
 
-
 package org.apache.cxf.jaxws.servlet;
 
-
-
-
-
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -36,10 +30,8 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-
 import javax.servlet.http.HttpServletResponse;
 
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.util.Base64Exception;
 import org.apache.cxf.common.util.Base64Utility;
@@ -52,6 +44,7 @@
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 
 
@@ -86,16 +79,16 @@
      */    
     public ServletDestination(Bus b,
                               ConduitInitiator ci,
-                              EndpointInfo ei,
-                              EndpointReferenceType ref)
+                              EndpointInfo ei)
         throws IOException {
         bus = b;
         conduitInitiator = ci;
         endpointInfo = ei;
         
-        reference = ref;
-        
-             
+        reference = new EndpointReferenceType();
+        AttributedURIType add = new AttributedURIType();
+        add.setValue(ei.getAddress());
+        reference.setAddress(add);
     }
 
     /**
@@ -231,6 +224,17 @@
      * @param headers the current set of headers
      */
     protected void copyResponseHeaders(Message message, HttpServletResponse response) {
+        String ct = (String) message.get(Message.CONTENT_TYPE);
+        String enc = (String) message.get(Message.ENCODING);
+        
+        if (null != ct) {
+            if (enc != null && ct.indexOf("charset=") == -1) {
+                ct = ct + "; charset=" + enc;
+            }
+            response.setContentType(ct);
+        } else if (enc != null) {
+            response.setContentType("text/xml; charset=" + enc);
+        }
     }
     
     
@@ -391,6 +395,14 @@
     
     protected boolean isOneWay(Message message) {
         return message.getExchange() != null && message.getExchange().isOneWay();
+    }
+
+    public MessageObserver getMessageObserver() {
+        return this.incomingObserver;
+    }
+
+    public EndpointInfo getEndpointInfo() {
+        return endpointInfo;
     }
 
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletTransportFactory.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletTransportFactory.java Mon Nov  6 18:06:28 2006
@@ -21,28 +21,25 @@
 package org.apache.cxf.jaxws.servlet;
 
 import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.annotation.Resource;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.AbstractTransportFactory;
-import org.apache.cxf.transport.Conduit;
-import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.DestinationFactory;
-import org.apache.cxf.ws.addressing.EndpointReferenceType;
 
 public class ServletTransportFactory extends AbstractTransportFactory
-    implements ConduitInitiator, DestinationFactory {
+    implements DestinationFactory {
 
-    EndpointReferenceType reference;
-    
     private Bus bus;    
+    private Map<String, ServletDestination> destinations = new HashMap<String, ServletDestination>();
     
-    public ServletTransportFactory(Bus b, EndpointReferenceType ref) {
-        bus = b;      
-        reference = ref;
+    public ServletTransportFactory(Bus b) {
+        bus = b;
     }
 
     public ServletTransportFactory() {
@@ -57,19 +54,13 @@
         this.bus = bus;
     }
 
-    public Conduit getConduit(EndpointInfo endpointInfo)
-        throws IOException {
-        return null;
-    }
-
-    public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target)
+    public synchronized Destination getDestination(EndpointInfo endpointInfo)
         throws IOException {
-        return null;
+        ServletDestination d = destinations.get(endpointInfo.getAddress());
+        if (d == null) { 
+            d = new ServletDestination(bus, null, endpointInfo);
+            destinations.put(endpointInfo.getAddress(), d);
+        }
+        return d;
     }
-
-    public Destination getDestination(EndpointInfo endpointInfo)
-        throws IOException {
-        return new ServletDestination(bus, null, endpointInfo, reference);
-    }
-
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java Mon Nov  6 18:06:28 2006
@@ -149,8 +149,8 @@
                 } else {
                     return Boolean.TRUE;
                 }
-            } else if (!method.getDeclaringClass().isInterface()) {
-                return Boolean.FALSE;
+            } else {
+                return method.getDeclaringClass().isInterface();
             }
         }
         return Boolean.FALSE;

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-servlet.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-servlet.xml?view=auto&rev=471966
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-servlet.xml (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-servlet.xml Mon Nov  6 18:06:28 2006
@@ -0,0 +1,38 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:foo="http://cxf.apache.org/configuration/foo"
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+    
+    <bean class="org.apache.cxf.jaxws.servlet.ServletTransportFactory">
+        <property name="bus" ref="cxf"/>
+        <property name="transportIds">
+            <set>
+                <value>http://schemas.xmlsoap.org/soap/http</value>
+                <value>http://schemas.xmlsoap.org/wsdl/http/</value>
+                <value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
+ 	            <value>http://www.w3.org/2003/05/soap/bindings/HTTP/</value>
+                <value>http://cxf.apache.org/transports/http/configuration</value>
+            </set>
+        </property>
+    </bean>
+</beans>

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-servlet.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-servlet.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-servlet.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsServerFactoryBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsServerFactoryBeanTest.java?view=diff&rev=471966&r1=471965&r2=471966
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsServerFactoryBeanTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsServerFactoryBeanTest.java Mon Nov  6 18:06:28 2006
@@ -20,6 +20,7 @@
 
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.jaxws.service.Hello;
+import org.apache.hello_world_doc_lit.GreeterImplDoc;
 
 public class JaxWsServerFactoryBeanTest extends AbstractJaxWsTest {
     public void testBean() {
@@ -27,6 +28,16 @@
         sf.setBus(getBus());
         sf.setAddress("http://localhost:9000/test");
         sf.setServiceClass(Hello.class);
+        sf.setStart(false);
+        
+        Server server = sf.create();
+        assertNotNull(server);
+    }
+    
+    public void testBareGreeter() throws Exception {
+        JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
+        sf.setBus(getBus());
+        sf.setServiceClass(GreeterImplDoc.class);
         sf.setStart(false);
         
         Server server = sf.create();

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/AbstractServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/AbstractServletTest.java?view=auto&rev=471966
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/AbstractServletTest.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/AbstractServletTest.java Mon Nov  6 18:06:28 2006
@@ -0,0 +1,100 @@
+/**
+ * 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.servlet;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+import org.xml.sax.SAXException;
+
+import com.meterware.httpunit.HttpException;
+import com.meterware.httpunit.HttpNotFoundException;
+import com.meterware.httpunit.HttpUnitOptions;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.servletunit.ServletRunner;
+import com.meterware.servletunit.ServletUnitClient;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactoryHelper;
+import org.apache.cxf.test.AbstractCXFTest;
+
+public abstract class AbstractServletTest extends AbstractCXFTest {
+
+    protected ServletRunner sr;
+
+    public void setUp() throws Exception {
+        sr = new ServletRunner(getResourceAsStream(getConfiguration()));
+        
+        try {
+            sr.newClient().getResponse("http://localhost/services/");
+        } catch (HttpNotFoundException e) {
+            // ignore, we just want to boot up the servlet
+        }
+        
+        super.setUp();
+
+        HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);        
+    }
+
+    @Override
+    public Bus getBus() {
+        return BusFactoryHelper.newInstance().getDefaultBus();
+    }
+
+    /**
+     * @return The web.xml to use for testing.
+     */
+    protected String getConfiguration() {
+        return "/org/apache/cxf/jaxws/servlet/web.xml";
+    }
+
+    protected ServletUnitClient newClient() {
+        return sr.newClient();
+    }
+
+    /**
+     * Here we expect an errorCode other than 200, and look for it checking for
+     * text is omitted as it doesnt work. It would never work on java1.3, but
+     * one may have expected java1.4+ to have access to the error stream in
+     * responses. Clearly not.
+     * 
+     * @param request
+     * @param errorCode
+     * @param errorText optional text string to search for
+     * @throws MalformedURLException
+     * @throws IOException
+     * @throws SAXException
+     */
+    protected void expectErrorCode(WebRequest request, int errorCode, String errorText)
+        throws MalformedURLException, IOException, SAXException {
+        String failureText = "Expected error " + errorCode + " from " + request.getURL();
+
+        try {
+            newClient().getResponse(request);
+            fail(errorText + " -got success instead");
+        } catch (HttpException e) {
+            assertEquals(failureText, errorCode, e.getResponseCode());
+            /*
+             * checking for text omitted as it doesnt work. if(errorText!=null) {
+             * assertTrue( "Failed to find "+errorText+" in "+
+             * e.getResponseMessage(), e.getMessage().indexOf(errorText)>=0); }
+             */
+        }
+    }
+}

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

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/AbstractServletTest.java
------------------------------------------------------------------------------
    svn:executable = *

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

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/CXFServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/CXFServletTest.java?view=auto&rev=471966
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/CXFServletTest.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/CXFServletTest.java Mon Nov  6 18:06:28 2006
@@ -0,0 +1,92 @@
+/**
+ * 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.servlet;
+
+import java.net.URL;
+
+import org.w3c.dom.Document;
+
+import com.meterware.httpunit.GetMethodWebRequest;
+import com.meterware.httpunit.PostMethodWebRequest;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+import com.meterware.servletunit.ServletUnitClient;
+
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.service.invoker.BeanInvoker;
+import org.apache.hello_world_soap_http.GreeterImpl;
+
+public class CXFServletTest extends AbstractServletTest {
+    public void testPostInvokeServices() throws Exception {
+        newClient();
+
+        JaxWsServerFactoryBean svr = new JaxWsServerFactoryBean();
+        URL resource = getClass().getResource("/wsdl/hello_world.wsdl");
+        assertNotNull(resource);
+        svr.getServiceFactory().setWsdlURL(resource);
+        svr.setBus(getBus());
+        svr.setServiceClass(GreeterImpl.class);
+        svr.setAddress("http://localhost/services/Greeter");
+
+        GreeterImpl greeter = new GreeterImpl();
+        BeanInvoker invoker = new BeanInvoker(greeter);
+        svr.getServiceFactory().setInvoker(invoker);
+
+        svr.create();
+
+        invoke("UTF-8");
+        invoke("iso-8859-1");
+    }
+
+    private void invoke(String encoding) throws Exception {
+        WebRequest req = new PostMethodWebRequest("http://localhost/services/Greeter", 
+            getClass().getResourceAsStream("/org/apache/cxf/jaxws/GreeterMessage.xml"), 
+            "text/xml; charset=" + encoding);
+
+        WebResponse response = newClient().getResponse(req);
+
+        assertEquals("text/xml", response.getContentType());
+        assertEquals(encoding, response.getCharacterSet());
+
+        Document doc = DOMUtils.readXml(response.getInputStream());
+        assertNotNull(doc);
+
+        addNamespace("h", "http://apache.org/hello_world_soap_http/types");
+
+        assertValid("/s:Envelope/s:Body", doc);
+        assertValid("//h:sayHiResponse", doc);
+    }
+
+    public void testInvalidServiceUrl() throws Exception {
+        ServletUnitClient client = newClient();
+        client.setExceptionsThrownOnErrorStatus(false);
+
+        WebResponse res = client.getResponse("http://localhost/services/NoSuchService");
+        assertEquals(404, res.getResponseCode());
+        assertEquals("text/html", res.getContentType());
+    }
+
+    public void xtestServiceWsdlNotFound() throws Exception {
+        WebRequest req = new GetMethodWebRequest("http://localhost/services/NoSuchService?wsdl");
+
+        expectErrorCode(req, 404, "Response code 404 required for invalid WSDL url.");
+    }
+
+}

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

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/CXFServletTest.java
------------------------------------------------------------------------------
    svn:executable = *

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

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/ExternalServicesServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/ExternalServicesServletTest.java?view=auto&rev=471966
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/ExternalServicesServletTest.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/ExternalServicesServletTest.java Mon Nov  6 18:06:28 2006
@@ -0,0 +1,56 @@
+/**
+ * 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.servlet;
+
+import org.w3c.dom.Document;
+
+import com.meterware.httpunit.PostMethodWebRequest;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+import org.apache.cxf.helpers.DOMUtils;
+
+public class ExternalServicesServletTest extends AbstractServletTest {
+    
+    @Override
+    protected String getConfiguration() {
+        return "/org/apache/cxf/jaxws/servlet/web-external.xml";
+    }
+
+    public void testPostInvokeServices() throws Exception {
+        newClient();
+        
+        WebRequest req = new PostMethodWebRequest("http://localhost/greeter1",
+                getClass().getResourceAsStream("/org/apache/cxf/jaxws/GreeterMessage.xml"),
+                "text/xml; charset=UTF-8");
+        
+        WebResponse response = newClient().getResponse(req);
+
+        assertEquals("text/xml", response.getContentType());
+        assertEquals("UTF-8", response.getCharacterSet());
+
+        Document doc = DOMUtils.readXml(response.getInputStream());
+        assertNotNull(doc);
+        
+        addNamespace("h", "http://apache.org/hello_world_soap_http/types");
+        
+        assertValid("/s:Envelope/s:Body", doc);
+        assertValid("//h:sayHiResponse", doc);
+    }
+}

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

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

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/SpringServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/SpringServletTest.java?view=auto&rev=471966
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/SpringServletTest.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/SpringServletTest.java Mon Nov  6 18:06:28 2006
@@ -0,0 +1,55 @@
+/**
+ * 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.servlet;
+
+import org.w3c.dom.Document;
+
+import com.meterware.httpunit.PostMethodWebRequest;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+import org.apache.cxf.helpers.DOMUtils;
+
+public class SpringServletTest extends AbstractServletTest {
+    @Override
+    protected String getConfiguration() {
+        return "/org/apache/cxf/jaxws/servlet/web-spring.xml";
+    }
+    
+    public void testInvokingSpringBeans() throws Exception {
+        newClient();
+
+        WebRequest req = new PostMethodWebRequest("http://localhost/services/Greeter", 
+            getClass().getResourceAsStream("/org/apache/cxf/jaxws/GreeterMessage.xml"), 
+            "text/xml; charset=utf-8");
+
+        WebResponse response = newClient().getResponse(req);
+
+        assertEquals("text/xml", response.getContentType());
+        assertEquals("utf-8", response.getCharacterSet());
+
+        Document doc = DOMUtils.readXml(response.getInputStream());
+        assertNotNull(doc);
+
+        addNamespace("h", "http://apache.org/hello_world_soap_http/types");
+
+        assertValid("/s:Envelope/s:Body", doc);
+        assertValid("//h:sayHiResponse", doc);
+    }
+}



Mime
View raw message