cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r529837 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/phase/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ rt/transports/http/src/main/java/org/apache/cxf/tr...
Date Wed, 18 Apr 2007 02:42:09 GMT
Author: dandiep
Date: Tue Apr 17 19:42:08 2007
New Revision: 529837

URL: http://svn.apache.org/viewvc?view=rev&rev=529837
Log:
o Fix for build breakage. I moved the conversion of the exception
  into a fault into the AbstractFaultChainInitiatorObserver. It
  seems there is some code (i.e. ClientImpl) that depends on having
  the original exception in the message still. So we just enforce
  that the Fault Message has a Fault now.
o Fix an interop issue with Jetty/.NET WSE. Jetty doesn't seem
  to be creating the Encoding correctly, so I added some custom
  code to trim an extra quote.
o Changed the MTOM test to use DataHandlers and xmime:expectedContentTypes
  so its easily testable with .NET.
 



Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxInInterceptor.java
    incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ClientFactoryBeanTest.java
    incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ReflectionServiceFactoryTest.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
    incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/mtom_xop/TestMtomImpl.java
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/mtom_xop.wsdl

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?view=diff&rev=529837&r1=529836&r2=529837
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
Tue Apr 17 19:42:08 2007
@@ -33,7 +33,6 @@
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.message.Message;
@@ -155,9 +154,7 @@
                     if (LOG.isLoggable(Level.INFO)) {
                         LogUtils.log(LOG, Level.INFO, "Interceptor has thrown exception,
unwinding now", ex);
                     }
-                    if (!(ex instanceof Fault)) {
-                        ex = new Fault(ex);
-                    }
+
                     message.setContent(Exception.class, ex);
                     if (message.getExchange() != null) {
                         message.getExchange().put(Exception.class, ex);

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java?view=diff&rev=529837&r1=529836&r2=529837
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java
Tue Apr 17 19:42:08 2007
@@ -54,6 +54,10 @@
 
         if (isOutboundObserver()) {
             Exception ex = message.getContent(Exception.class);
+            if (!(ex instanceof Fault)) {
+                ex = new Fault(ex);
+            }
+            
             faultMessage = exchange.getOutMessage();
             if (null == faultMessage) {
                 faultMessage = exchange.get(Endpoint.class).getBinding().createMessage();

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=529837&r1=529836&r2=529837
==============================================================================
--- 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
Tue Apr 17 19:42:08 2007
@@ -59,9 +59,7 @@
         assert is != null;
 
         String encoding = (String)message.get(Message.ENCODING);
-        
-        encoding = extractEncoding(encoding);
-        
+
         XMLStreamReader reader;
         try {
             reader = getXMLInputFactory(message).createXMLStreamReader(is, encoding);
@@ -70,20 +68,6 @@
         }
 
         message.setContent(XMLStreamReader.class, reader);
-    }
-
-    private String extractEncoding(String encoding) {
-        if (encoding != null) {
-            int csIdx = encoding.indexOf("charset=");
-            if (csIdx != -1) {
-                int end = encoding.indexOf(';', csIdx + 1);
-                if (end == -1) {
-                    end = encoding.length();
-                }
-                encoding = encoding.substring(csIdx, end);
-            }
-        }
-        return encoding;
     }
 
     public static XMLInputFactory getXMLInputFactory(Message m) throws Fault {

Modified: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ClientFactoryBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ClientFactoryBeanTest.java?view=diff&rev=529837&r1=529836&r2=529837
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ClientFactoryBeanTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ClientFactoryBeanTest.java
Tue Apr 17 19:42:08 2007
@@ -41,7 +41,6 @@
         
         ClientFactoryBean cfBean = new ClientFactoryBean();
         cfBean.setAddress("http://localhost/Hello");
-        cfBean.setTransportId("http://schemas.xmlsoap.org/wsdl/soap/");
         cfBean.setBus(getBus());
         cfBean.setServiceClass(HelloService.class);
         

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=529837&r1=529836&r2=529837
==============================================================================
--- 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
Tue Apr 17 19:42:08 2007
@@ -137,7 +137,6 @@
         
         ServerFactoryBean svrBean = new ServerFactoryBean();
         svrBean.setAddress("http://localhost/Hello");
-        svrBean.setTransportId("http://schemas.xmlsoap.org/wsdl/soap/");
         svrBean.setServiceFactory(serviceFactory);
         svrBean.setBus(getBus());
         

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?view=diff&rev=529837&r1=529836&r2=529837
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Tue Apr 17 19:42:08 2007
@@ -154,7 +154,15 @@
             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());
+            
+            // work around a bug with Jetty which results in the character
+            // encoding not being trimmed correctly.
+            String enc = request.getCharacterEncoding();
+            if (enc.endsWith("\"")) {
+                enc = enc.substring(0, enc.length() - 1);
+            }
+            
+            inMessage.put(Message.ENCODING, enc);
             SSLUtils.propogateSecureSession(request, inMessage);
             d.doMessage(inMessage);
         } catch (IOException e) {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java?view=diff&rev=529837&r1=529836&r2=529837
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
Tue Apr 17 19:42:08 2007
@@ -23,6 +23,8 @@
 import java.lang.reflect.Proxy;
 import java.lang.reflect.UndeclaredThrowableException;
 
+import javax.activation.DataHandler;
+import javax.mail.util.ByteArrayDataSource;
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Holder;
@@ -94,14 +96,15 @@
             for (int i = pre.read(); i != -1; i = pre.read()) {
                 fileSize++;
             }
-            Holder<byte[]> param = new Holder<byte[]>();
-            param.value = new byte[(int) fileSize];
-            this.getClass().getResourceAsStream("/wsdl/mtom_xop.wsdl").read(param.value);
-            String target = new String(param.value);
+            Holder<DataHandler> param = new Holder<DataHandler>();
+            byte[] data = new byte[(int) fileSize];
+            this.getClass().getResourceAsStream("/wsdl/mtom_xop.wsdl").read(data);
+            param.value = new DataHandler(new ByteArrayDataSource(data, "application/octet-stream"));
+            
             Holder<String> name = new Holder<String>("call detail");
             mtomPort.testXop(name, param);
             assertEquals("name unchanged", "return detail + call detail", name.value);
-            assertEquals("attachinfo changed", target, new String(param.value));
+            assertNotNull(param.value);
         } catch (UndeclaredThrowableException ex) {
             throw (Exception) ex.getCause();
         }

Modified: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/mtom_xop/TestMtomImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/mtom_xop/TestMtomImpl.java?view=diff&rev=529837&r1=529836&r2=529837
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/mtom_xop/TestMtomImpl.java
(original)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/mtom_xop/TestMtomImpl.java
Tue Apr 17 19:42:08 2007
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.mtom_xop;
 
+import javax.activation.DataHandler;
 import javax.jws.WebService;
 import javax.xml.ws.Holder;
 
@@ -32,7 +33,7 @@
         
 public class TestMtomImpl implements TestMtom {
 
-    public void testXop(Holder<String> name, Holder<byte[]> attachinfo) {
+    public void testXop(Holder<String> name, Holder<DataHandler> attachinfo)
{
         // TODO Auto-generated method stub
         name.value = "return detail + " + name.value;
     }

Modified: incubator/cxf/trunk/testutils/src/main/resources/wsdl/mtom_xop.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/mtom_xop.wsdl?view=diff&rev=529837&r1=529836&r2=529837
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/mtom_xop.wsdl (original)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/mtom_xop.wsdl Tue Apr 17 19:42:08
2007
@@ -22,7 +22,7 @@
 <wsdl:definitions name="SOAPBuilders-mime-cr-test" xmlns:types="http://cxf.apache.org/mime/types"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://cxf.apache.org/mime"
-    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://cxf.apache.org/mime">
+    xmlns:xmime="http://www.w3.org/2005/05/xmlmime" targetNamespace="http://cxf.apache.org/mime">
 
     <wsdl:types>
         <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://cxf.apache.org/mime/types"
@@ -30,7 +30,7 @@
             <complexType name="XopType">
                 <sequence>
                     <element name="name" type="xsd:string" />
-                    <element name="attachinfo" type="xsd:base64Binary" />
+                    <element name="attachinfo" type="xsd:base64Binary" xmime:expectedContentTypes="application/octet-stream"/>
                 </sequence>
             </complexType>
             <element name="testXop" type="types:XopType" />



Mime
View raw message