cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r835191 - in /cxf/branches/2.2.x-fixes: ./ common/common/src/main/java/org/apache/cxf/helpers/ rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/core/src/main/java/org...
Date Thu, 12 Nov 2009 02:10:28 GMT
Author: dkulp
Date: Thu Nov 12 02:10:15 2009
New Revision: 835191

URL: http://svn.apache.org/viewvc?rev=835191&view=rev
Log:
Merged revisions 835187 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r835187 | dkulp | 2009-11-11 20:43:34 -0500 (Wed, 11 Nov 2009) | 1 line
  
  [CXF-758] Allow empty post into Provider<Source> things
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
    cxf/branches/2.2.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
    cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java
    cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadXMLBindingProvider.java
    cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
    cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java

Propchange: cxf/branches/2.2.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java?rev=835191&r1=835190&r2=835191&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
(original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
Thu Nov 12 02:10:15 2009
@@ -32,6 +32,7 @@
     public static final String CONTENT_TYPE = "Content-Type";
     public static final String CONTENT_ID = "Content-ID";
     public static final String CONTENT_ENCODING = "Content-Encoding";
+    public static final String CONTENT_LENGTH = "Content-Length";
     public static final String CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
     public static final String COOKIE = "Cookie";
     public static final String TRANSFER_ENCODING = "Transfer-Encoding";
@@ -55,13 +56,14 @@
         internalHeaders.put("authorization", "Authorization");
         internalHeaders.put("soapaction", "SOAPAction");
         internalHeaders.put("accept", "Accept");
+        internalHeaders.put("content-length", "Content-Length");
     }
     
     private HttpHeaderHelper() {
         
     }
     
-    public static List getHeader(Map<String, List<String>> headerMap, String
key) {
+    public static List<String> getHeader(Map<String, List<String>> headerMap,
String key) {
         return headerMap.get(getHeaderKey(key));
     }
     

Modified: cxf/branches/2.2.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java?rev=835191&r1=835190&r2=835191&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java
Thu Nov 12 02:10:15 2009
@@ -63,6 +63,9 @@
         Endpoint ep = message.getExchange().get(Endpoint.class);
 
         XMLStreamReader xsr = message.getContent(XMLStreamReader.class);
+        if (xsr == null) {
+            return;
+        }
         DepthXMLStreamReader reader = new DepthXMLStreamReader(xsr);
         if (!StaxUtils.toNextElement(reader)) {
             throw new Fault(new org.apache.cxf.common.i18n.Message("NO_OPERATION_ELEMENT",
LOG));

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java?rev=835191&r1=835190&r2=835191&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
Thu Nov 12 02:10:15 2009
@@ -119,6 +119,9 @@
     
     protected DepthXMLStreamReader getXMLStreamReader(Message message) {
         XMLStreamReader xr = message.getContent(XMLStreamReader.class);
+        if (xr == null) {
+            return null;
+        }
         if (xr instanceof DepthXMLStreamReader) {
             return (DepthXMLStreamReader) xr;
         }

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java?rev=835191&r1=835190&r2=835191&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
Thu Nov 12 02:10:15 2009
@@ -73,7 +73,7 @@
 
         //if body is empty and we have BindingOperationInfo, we do not need to match 
         //operation anymore, just return
-        if (!StaxUtils.toNextElement(xmlReader) && bop != null) {
+        if (bop != null && !StaxUtils.toNextElement(xmlReader)) {
             // body may be empty for partial response to decoupled request
             return;
         }
@@ -84,7 +84,9 @@
         }
 
         if (bop == null) {
-            QName startQName = xmlReader.getName();
+            QName startQName = xmlReader == null 
+                ? new QName("http://cxf.apache.org/jaxws/provider", "invoke")
+                : xmlReader.getName();
             bop = getBindingOperationInfo(exchange, startQName, client);
         }
 
@@ -143,7 +145,7 @@
                 operations = new ArrayList<OperationInfo>();
                 operations.addAll(si.getInterface().getOperations());
     
-                if (!StaxUtils.toNextElement(xmlReader)) {
+                if (xmlReader == null || !StaxUtils.toNextElement(xmlReader)) {
                     // empty input
     
                     // TO DO : check duplicate operation with no input

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java?rev=835191&r1=835190&r2=835191&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java
Thu Nov 12 02:10:15 2009
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
 
@@ -31,6 +32,9 @@
 
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
@@ -73,7 +77,22 @@
             throw new Fault(new org.apache.cxf.common.i18n.Message("INVALID_HTML_RESPONSETYPE",
                     LOG, (htmlMessage == null || htmlMessage.length() == 0) ? "(none)" :
htmlMessage));
         }
-        
+        if (contentType == null) {
+            //if contentType is null, this is likely a an empty post/put/delete/similar,
lets see if it's
+            //detectable at all
+            Map<String, List<String>> m = CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS));
+            if (m != null) {
+                List<String> contentLen = HttpHeaderHelper
+                    .getHeader(m, HttpHeaderHelper.CONTENT_LENGTH);
+                List<String> contentTE = HttpHeaderHelper
+                    .getHeader(m, HttpHeaderHelper.CONTENT_TRANSFER_ENCODING);
+                if ((StringUtils.isEmpty(contentLen) || "0".equals(contentLen.get(0)))
+                    && StringUtils.isEmpty(contentTE)) {
+                    return;
+                }
+            }
+        }
+
         String encoding = (String)message.get(Message.ENCODING);
 
         XMLStreamReader reader;

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java?rev=835191&r1=835190&r2=835191&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/AbstractInvoker.java
Thu Nov 12 02:10:15 2009
@@ -52,14 +52,16 @@
         try {
 
             BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
-            if (bop == null) {
+            MethodDispatcher md = (MethodDispatcher) 
+                exchange.get(Service.class).get(MethodDispatcher.class.getName());
+            Method m = md.getMethod(bop);
+            if (m == null && bop == null) {
                 LOG.severe(new Message("MISSING_BINDING_OPERATION", LOG).toString());
                 throw new Fault(new Message("EXCEPTION_INVOKING_OBJECT", LOG, 
                                              "No binding operation info", "unknown method",
"unknown"));
             }
-            MethodDispatcher md = (MethodDispatcher) 
-                exchange.get(Service.class).get(MethodDispatcher.class.getName());
-            Method m = md.getMethod(bop);
+            
+            
             //Method m = (Method)bop.getOperationInfo().getProperty(Method.class.getName());
             m = matchMethod(m, serviceObject);
             

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java?rev=835191&r1=835190&r2=835191&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
Thu Nov 12 02:10:15 2009
@@ -20,9 +20,11 @@
 package org.apache.cxf.jaxws;
 
 import java.lang.reflect.Method;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
+import javax.xml.ws.Provider;
 import javax.xml.ws.handler.MessageContext.Scope;
 
 import org.apache.cxf.helpers.CastUtils;
@@ -52,6 +54,9 @@
         WebServiceContextImpl.setMessageContext(ctx);
         List<Object> res = null;
         try {
+            if ((params == null || params.isEmpty()) && m.getDeclaringClass().equals(Provider.class))
{
+                params = Collections.singletonList(null);
+            }
             res = CastUtils.cast((List)super.invoke(exchange, serviceObject, m, params));
             addHandlerProperties(ctx, handlerScopedStuff);
             //update the webservice response context

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java?rev=835191&r1=835190&r2=835191&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
Thu Nov 12 02:10:15 2009
@@ -74,8 +74,8 @@
         this.bindingName = bname;
     }
     public void handleMessage(Message message) throws Fault {
-        if (!bindingName.equals(message.getExchange().get(BindingOperationInfo.class)
-                                .getBinding().getName())) {
+        BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
+        if (bop != null && !bindingName.equals(bop.getBinding().getName())) {
             return;
         }
         if (saajOut != null) {

Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java?rev=835191&r1=835190&r2=835191&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java
Thu Nov 12 02:10:15 2009
@@ -66,8 +66,8 @@
         Map<String, List<String>> protocolHeaders = CastUtils.cast((Map<?,
?>)message
             .get(Message.PROTOCOL_HEADERS));
         if (protocolHeaders != null) {
-            List<String> contentEncoding = CastUtils.cast(HttpHeaderHelper
-                .getHeader(protocolHeaders, HttpHeaderHelper.CONTENT_ENCODING));
+            List<String> contentEncoding = HttpHeaderHelper.getHeader(protocolHeaders,

+                                                                      HttpHeaderHelper.CONTENT_ENCODING);
             if (contentEncoding != null
                 && (contentEncoding.contains("gzip") || contentEncoding.contains("x-gzip")))
{
                 try {

Modified: cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadXMLBindingProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadXMLBindingProvider.java?rev=835191&r1=835190&r2=835191&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadXMLBindingProvider.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadXMLBindingProvider.java
Thu Nov 12 02:10:15 2009
@@ -54,10 +54,11 @@
     }
 
     public DOMSource invoke(DOMSource request) {
-        
-        QName qn = (QName)ctx.getMessageContext().get(MessageContext.WSDL_OPERATION);
-        if (qn == null) {
-            throw new RuntimeException("No Operation Name");
+        if (request != null) {
+            QName qn = (QName)ctx.getMessageContext().get(MessageContext.WSDL_OPERATION);
+            if (qn == null) {
+                throw new RuntimeException("No Operation Name");
+            }
         }
         
         DocumentBuilderFactory factory;

Modified: cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java?rev=835191&r1=835190&r2=835191&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
Thu Nov 12 02:10:15 2009
@@ -58,7 +58,7 @@
     public static void startServers() throws Exception {
         assertTrue("server did not launch correctly", launchServer(Server.class));
     }
-
+    
     @Test
     public void testSOAPMessageModeDocLit() throws Exception {
         

Modified: cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java?rev=835191&r1=835190&r2=835191&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java
Thu Nov 12 02:10:15 2009
@@ -20,6 +20,7 @@
 package org.apache.cxf.systest.provider;
 
 import java.io.InputStream;
+import java.net.HttpURLConnection;
 import java.net.URL;
 
 import javax.xml.namespace.QName;
@@ -50,6 +51,16 @@
     }
 
     @Test
+    public void testEmptyPost() throws Exception {
+        URL url = new URL("http://localhost:9022/XMLService/XMLProviderPort");
+        HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+        connection.setRequestMethod("POST");
+        connection.setDoInput(true);
+        int i = connection.getResponseCode();
+        assertEquals(200, i);
+        assertTrue(connection.getContentType().indexOf("xml") != -1);
+    }
+    @Test
     public void testDOMSourcePAYLOAD() throws Exception {
         URL wsdl = getClass().getResource("/wsdl/hello_world_xml_wrapped.wsdl");
         assertNotNull(wsdl);



Mime
View raw message