cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r514501 - in /incubator/cxf/trunk/rt: bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ co...
Date Mon, 05 Mar 2007 00:10:20 GMT
Author: dandiep
Date: Sun Mar  4 16:10:18 2007
New Revision: 514501

URL: http://svn.apache.org/viewvc?view=rev&rev=514501
Log:
-Fix a bug where the HTTP binding wasn't writing out content types correctlybecause the content
type was being set on the EndpointInfo not the Endpoint.-Do a writeEndDocument() on SoapOutInteceptor-Decrease
logging in AbstractDestination.

Modified:
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ContentTypeOutInterceptor.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.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/interceptor/SoapOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
    incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ReflectionServiceFactoryTest.java

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ContentTypeOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ContentTypeOutInterceptor.java?view=diff&rev=514501&r1=514500&r2=514501
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ContentTypeOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ContentTypeOutInterceptor.java
Sun Mar  4 16:10:18 2007
@@ -23,6 +23,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.interceptor.Fault;
@@ -43,14 +44,14 @@
             headers = new HashMap<String, List<String>>();
             message.put(Message.PROTOCOL_HEADERS, headers);
         }
-        String ct = (String)message.getContextualProperty(HttpHeaderHelper
-            .getHeaderKey(HttpHeaderHelper.CONTENT_TYPE));
-        if (ct == null) {
-            ct = "text/xml";
+        String ct = (String)message.getExchange().get(Endpoint.class).get(HttpHeaderHelper.CONTENT_TYPE);
+        if (ct != null) {
+            List<String> contentType = new ArrayList<String>();
+            contentType.add(ct);
+            headers.put(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE), contentType);
+            message.put(HttpHeaderHelper.CONTENT_TYPE, ct);
         }
-        List<String> contentType = new ArrayList<String>();
-        contentType.add(ct);
-        headers.put(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE), contentType);
+        
     }
 
 }

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java?view=diff&rev=514501&r1=514500&r2=514501
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
Sun Mar  4 16:10:18 2007
@@ -86,7 +86,6 @@
                 chain.add(STAX_OUT);
             } else {
                 chain.add(new URIParameterOutInterceptor());
-                
             }
            
         } else {

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=514501&r1=514500&r2=514501
==============================================================================
--- 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
Sun Mar  4 16:10:18 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.binding.http.bare;
 
+import java.net.HttpURLConnection;
+import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -113,4 +115,29 @@
         svr.stop();
     }
 
+    public void testSetContentType() throws Exception {
+        BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class);
+        bfm.registerBindingFactory(HttpBindingFactory.HTTP_BINDING_ID, new HttpBindingFactory());
+        
+        JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
+        sf.setBus(getBus());
+        sf.setServiceClass(CustomerService.class);
+        sf.getServiceFactory().setWrapped(false);
+        sf.setBindingFactory(new HttpBindingInfoFactoryBean());
+        sf.setAddress("http://localhost:9001/foo/");
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put("Content-Type", "text/plain");
+        sf.setProperties(props);
+        
+        ServerImpl svr = (ServerImpl) sf.create();
+        
+        URL url = new URL("http://localhost:9001/foo/customers/123");
+        HttpURLConnection c = (HttpURLConnection)url.openConnection();
+        c.setRequestMethod("GET");
+        
+        assertEquals("text/plain", c.getContentType());
+
+        svr.stop();
+    }
 }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?view=diff&rev=514501&r1=514500&r2=514501
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
Sun Mar  4 16:10:18 2007
@@ -88,6 +88,7 @@
             xtw.writeEndElement();            
             // Write Envelope end element
             xtw.writeEndElement();
+            xtw.writeEndDocument();
             
             xtw.flush();
             

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=514501&r1=514500&r2=514501
==============================================================================
--- 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
Sun Mar  4 16:10:18 2007
@@ -81,6 +81,7 @@
         try {
             XMLStreamWriter xtw = message.getContent(XMLStreamWriter.class);
             if (xtw != null) {
+                xtw.writeEndDocument();
                 xtw.close();
             }
             

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java?view=diff&rev=514501&r1=514500&r2=514501
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java
Sun Mar  4 16:10:18 2007
@@ -116,12 +116,12 @@
             MessageObserver old = incomingObserver;
             incomingObserver = observer;
             if (observer != null) {
-                getLogger().info("registering incoming observer: " + observer);
+                getLogger().fine("registering incoming observer: " + observer);
                 if (old == null) {
                     activate();
                 }
             } else {
-                getLogger().info("unregistering incoming observer: " + incomingObserver);
+                getLogger().fine("unregistering incoming observer: " + incomingObserver);
                 if (old != null) {
                     deactivate();
                 }

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java?view=diff&rev=514501&r1=514500&r2=514501
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
Sun Mar  4 16:10:18 2007
@@ -72,25 +72,18 @@
         } else if (getAddress() != null) {
             ei.setAddress(getAddress()); 
         }                        
-        
-        setProps(ei);
-        
+
         ep = service.getEndpoints().get(ei.getName());
         if (ep == null) {
             ep = serviceFactory.createEndpoint(ei);
         }
-        service.getEndpoints().put(ep.getEndpointInfo().getName(), ep);
-        return ep;
-    }
-
-    private void setProps(EndpointInfo ei) {
-        if (properties == null) {
-            return;
-        }
         
-        for (Map.Entry<String, Object> e : properties.entrySet()) {
-            ei.setProperty(e.getKey(), e.getValue());
+        if (properties != null) {
+            ep.putAll(properties);
         }
+        
+        service.getEndpoints().put(ep.getEndpointInfo().getName(), ep);
+        return ep;
     }
 
     protected EndpointInfo createEndpointInfo() throws BusException {

Modified: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ReflectionServiceFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ReflectionServiceFactoryTest.java?view=diff&rev=514501&r1=514500&r2=514501
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ReflectionServiceFactoryTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ReflectionServiceFactoryTest.java
Sun Mar  4 16:10:18 2007
@@ -150,7 +150,7 @@
         Endpoint ep = eps.values().iterator().next();
         EndpointInfo endpointInfo = ep.getEndpointInfo();
         
-        assertEquals("test", endpointInfo.getProperty("test"));
+        assertEquals("test", ep.get("test"));
         
         SOAPAddress soapAddress = endpointInfo.getExtensor(SOAPAddress.class);
         assertNotNull(soapAddress);



Mime
View raw message