You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by tl...@apache.org on 2006/11/24 09:54:43 UTC

svn commit: r478805 [1/2] - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/helpers/ distribution/src/main/release/samples/mtom/ distribution/src/main/release/samples/mtom/src/ distribution/src/main/release/samples/mtom/src/demo/ di...

Author: tli
Date: Fri Nov 24 00:54:41 2006
New Revision: 478805

URL: http://svn.apache.org/viewvc?view=rev&rev=478805
Log:
refactor the mtom systest & demo (using new wsdl), discard the swa test, add Http Header constants mapping, add copy request header for servlet transport

Added:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java   (with props)
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/README.txt   (with props)
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/build.xml   (with props)
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/client/
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java   (with props)
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/client/me.bmp   (with props)
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/Server.java   (with props)
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomImpl.java   (with props)
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/cxf-servlet.xml   (with props)
    incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/mtom_xop.wsdl   (with props)
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/mtom_xop.wsdl   (with props)
Removed:
    incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/mtom_xop/HelloImpl.java
Modified:
    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/URIParameterInterceptor.java
    incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestUtil.java
    incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/attachments/AttachmentTest.java
    incubator/cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/attachments/primarySoapPart.xml
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentDeserializer.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentSerializer.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentUtil.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainIntiatorObserver.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletController.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletDestination.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HolderTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/echoData.xml
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBeanTest.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ServerMtomXopTest.java

Added: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java?view=auto&rev=478805
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java (added)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java Fri Nov 24 00:54:41 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.helpers;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public final class HttpHeaderHelper {
+    
+    public static final String CONTENT_TYPE = "Content-Type";
+    public static final String CONTENT_ID = "Content-ID";
+    public static final String CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
+    
+    private static Map<String, String> internalHeaders = new HashMap<String, String>();
+    
+    static {
+        internalHeaders.put("Content-Type", "content-type");
+        internalHeaders.put("Content-ID", "content-id");
+        internalHeaders.put("Content-Transfer-Encoding", "content-transfer-encoding"); 
+    }
+    
+    private HttpHeaderHelper() {
+        
+    }
+    
+    public static List getHeader(Map<String, List<String>> headerMap, String key) {
+        return headerMap.get(getHeaderKey(key));
+    }
+    
+    public static String getHeaderKey(String key) {
+        if (internalHeaders.containsKey(key)) {
+            return internalHeaders.get(key);
+        } else {
+            return key;
+        }
+    }
+}

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/README.txt
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/mtom/README.txt?view=auto&rev=478805
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/mtom/README.txt (added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/mtom/README.txt Fri Nov 24 00:54:41 2006
@@ -0,0 +1,155 @@
+MTOM Demo for SWA & XOP
+=============================================
+
+This demo illustrates the use of a SOAP message 
+with an attachment and XML-binary Optimized Packaging.
+
+Please review the README in the samples directory before
+continuing.
+
+
+
+Prerequisite
+------------
+
+If your environment already includes cxf-incubator.jar on the
+CLASSPATH, and the JDK and ant bin directories on the PATH
+it is not necessary to set the environment as described in
+the samples directory's README.  If your environment is not
+properly configured, or if you are planning on using wsdl2java,
+javac, and java to build and run the demos, you must set the
+environment.
+
+
+
+Building and running the demo using ant
+---------------------------------------
+
+From the samples/mtom directory, the ant build script
+can be used to build and run the demo.
+
+Using either UNIX or Windows:
+
+  ant build
+  ant server
+  ant client
+    
+
+To remove the code generated from the WSDL file and the .class
+files, run:
+
+  ant clean
+
+
+
+Building the demo using wsdl2java and javac
+-------------------------------------------
+
+From the samples/mtom directory, first create the target
+directory build/classes and then generate code from the WSDL file.
+
+For UNIX:
+  mkdir -p build/classes
+
+  wsdl2java -d build/classes -compile ./wsdl/mtom_xop.wsdl
+
+For Windows:
+  mkdir build\classes
+    Must use back slashes.
+
+  wsdl2java -d build\classes -compile .\wsdl\mtom_xop.wsdl
+    May use either forward or back slashes.
+
+Now compile the provided client and server applications with the commands:
+
+For UNIX:  
+  
+  export CLASSPATH=$CLASSPATH:$CXF_HOME/lib/cxf-incubator.jar:./build/classes
+  javac -d build/classes src/demo/mtom/client/*.java
+  javac -d build/classes src/demo/mtom/server/*.java
+  cp src/demo/mtom/client/me.bmp build/classes/demo/mtom/client/me.bmp
+
+For Windows:
+  set classpath=%classpath%;%CXF_HOME%\lib\cxf-incubator.jar;.\build\classes
+  javac -d build\classes src\demo\mtom\client\*.java
+  javac -d build\classes src\demo\mtom\server\*.java
+  copy src\demo\mtom\client\me.bmp build\classes\demo\mtom\client\me.bmp
+
+
+Running the demo using java
+---------------------------
+
+From the samples/mtom directory run the following commands. 
+They are entered on a single command line.
+
+For UNIX (must use forward slashes):
+    java -Djava.util.logging.config.file=$CXF_HOME/etc/logging.properties
+         demo.mtom.server.Server &
+
+    java -Djava.util.logging.config.file=$CXF_HOME/etc/logging.properties
+         demo.mtom.client.Client ./wsdl/mtom_xop.wsdl
+
+The server process starts in the background.  After running the client,
+use the kill command to terminate the server process.
+
+For Windows (may use either forward or back slashes):
+  start 
+    java -Djava.util.logging.config.file=%CXF_HOME%\etc\logging.properties
+         demo.mtom.server.Server
+
+    java -Djava.util.logging.config.file=%CXF_HOME%\etc\logging.properties
+       demo.mtom.client.Client .\wsdl\mtom_xop.wsdl
+
+A new command windows opens for the server process.  After running the
+client, terminate the server process by issuing Ctrl-C in its command window.
+
+To remove the code generated from the WSDL file and the .class
+files, either delete the build directory and its contents or run:
+
+  ant clean
+
+
+
+Building and running the demo in a servlet container
+----------------------------------------------------
+
+From the samples/mtom directory, the ant build script
+can be used to create the war file that is deployed into the
+servlet container.
+
+Build the war file with the command:
+
+  ant war
+    
+
+The war file will be included in the directory
+samples/mtom/build/war.  Simply copy the war file into
+the servlet container's deployment directory.  For example,
+with Tomcat copy the war file into the directory
+<installationDirectory>/webapps.  The servlet container will
+extract the war and deploy the application.
+
+Make sure already copy all jars from CXF_HOME/lib to
+<TomcatInstallationDirectory>/shared/lib
+
+Using ant, run the client application with the command:
+
+  ant client-servlet -Dbase.url=http://localhost:#
+
+Where # is the TCP/IP port used by the servlet container,
+e.g., 8080.
+
+Using java, run the client application with the command:
+
+  For UNIX:
+    
+    java -Djava.util.logging.config.file=$CXF_HOME/etc/logging.properties
+         demo.mtom.client.Client http://localhost:#/mtom
+
+  For Windows:
+
+    java -Djava.util.logging.config.file=%CXF_HOME%\etc\logging.properties
+       demo.mtom.client.Client http://localhost:#/mtom
+
+Where # is the TCP/IP port used by the servlet container,
+e.g., 8080.

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/README.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/build.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/mtom/build.xml?view=auto&rev=478805
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/mtom/build.xml (added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/mtom/build.xml Fri Nov 24 00:54:41 2006
@@ -0,0 +1,52 @@
+<?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.
+-->
+<project name="mtom demo" default="build" basedir=".">
+
+    <import file="../common_build.xml"/>        
+        
+    <target name="client" description="run demo client" depends="build">
+        <copy toFile="${build.classes.dir}/demo/mtom/client/me.bmp" file="${basedir}/src/demo/mtom/client/me.bmp"/>
+        <property name="param" value=""/>
+        <cxfrun classname="demo.mtom.client.Client"
+            param1="${basedir}/wsdl/mtom_xop.wsdl" 
+            param2="${op}" 
+            param3="${param}"/>
+    </target> 
+        
+    <target name="server" description="run demo server" depends="build">
+        <cxfrun classname="demo.mtom.server.Server" 
+            param1="${basedir}/wsdl/mtom_xop.wsdl"/>
+    </target>
+        
+    <target name="generate.code">
+        <echo level="info" message="Generating code using wsdl2java..."/>
+        <wsdl2java file="mtom_xop.wsdl"/>
+    </target>
+    
+    <target name="war" depends="build">
+        <copy toFile="${build.classes.dir}/demo/mtom/client/me.bmp" file="${basedir}/src/demo/mtom/client/me.bmp"/>
+        <cxfwar wsdl="*.*" filename="mtom.war"/>
+	</target>
+
+    <target name="client-servlet" description="run demo client hitting servlet" depends="build">
+        <property name="param" value=""/>
+        <cxfrun classname="demo.mtom.client.Client" param1="${base.url}/mtom/services/mtom?wsdl" param2="${op}"/>
+    </target> 
+</project>

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/build.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/build.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java?view=auto&rev=478805
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java (added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java Fri Nov 24 00:54:41 2006
@@ -0,0 +1,99 @@
+/**
+ * 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 demo.mtom.client;
+
+import java.awt.Image;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.imageio.ImageIO;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Holder;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.apache.cxf.mime.TestMtom;
+import org.apache.cxf.mime.TestMtomService;
+
+public final class Client {
+
+    private static final QName SERVICE_NAME = new QName("http://cxf.apache.org/mime", "TestMtomService");
+
+    private static final QName PORT_NAME = new QName("http://cxf.apache.org/mime", "TestMtomPort");
+
+    private Client() {
+    }
+
+    public static void main(String args[]) throws Exception {
+
+        Client client = new Client();
+
+        if (args.length == 0) {
+            System.out.println("please specify wsdl");
+            System.exit(1);
+        }
+        URL wsdlURL;
+        File wsdlFile = new File(args[0]);
+
+        if (wsdlFile.exists()) {
+            wsdlURL = wsdlFile.toURL();
+        } else {
+            wsdlURL = new URL(args[0]);
+        }
+        System.out.println(wsdlURL);
+
+        TestMtomService tms = new TestMtomService(wsdlURL, SERVICE_NAME);
+        TestMtom port = (TestMtom) tms.getPort(PORT_NAME, TestMtom.class);
+        Binding binding = ((BindingProvider)port).getBinding();
+        ((SOAPBinding)binding).setMTOMEnabled(true);
+
+        InputStream pre = client.getClass().getResourceAsStream("me.bmp");
+        long fileSize = 0;
+        for (int i = pre.read(); i != -1; i = pre.read()) {
+            fileSize++;
+        }
+        Holder<byte[]> param = new Holder<byte[]>();
+        param.value = new byte[(int) fileSize];
+        System.out.println("Start test the XML-binary Optimized Packaging!");
+        System.out.println("Sending out the me.bmp Image content to server, data size is " + fileSize);
+
+        InputStream in = client.getClass().getResourceAsStream("me.bmp");
+        in.read(param.value);
+        Holder<String> name = new Holder<String>("call detail");
+        port.testXop(name, param);
+        System.out.println("received byte[] back from server, the size is " + param.value.length);
+
+        Image image = ImageIO.read(new ByteArrayInputStream(param.value));
+        System.out.println("build image with the returned byte[] back from server successfully, hashCode="
+                + image.hashCode());
+        System.out.println("Successfully run demo mtom/xop");
+        System.exit(0);
+    }
+
+    private static InputStream getResourceStream(File file) throws Exception {
+        InputStream in = new FileInputStream(file);
+        return in;
+    }
+}

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/client/me.bmp
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/client/me.bmp?view=auto&rev=478805
==============================================================================
Binary file - no diff available.

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/client/me.bmp
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/Server.java?view=auto&rev=478805
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/Server.java (added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/Server.java Fri Nov 24 00:54:41 2006
@@ -0,0 +1,45 @@
+/**
+ * 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 demo.mtom.server;
+
+import javax.xml.ws.Binding;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.soap.SOAPBinding;
+
+public class Server {
+
+    protected Server() throws Exception {
+        System.out.println("Starting Server");
+        Object implementor = new TestMtomImpl();
+        String address = "http://localhost:9000/mime-test";
+        Endpoint ep = Endpoint.publish(address, implementor);
+        Binding binding = ep.getBinding();        
+        ((SOAPBinding)binding).setMTOMEnabled(true);        
+    }
+
+    public static void main(String args[]) throws Exception {
+        new Server();
+        System.out.println("Server ready...");
+
+        Thread.sleep(5 * 60 * 1000);
+        System.out.println("Server exiting");
+        System.exit(0);
+    }
+}

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/Server.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/Server.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomImpl.java?view=auto&rev=478805
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomImpl.java (added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomImpl.java Fri Nov 24 00:54:41 2006
@@ -0,0 +1,41 @@
+/**
+ * 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 demo.mtom.server;
+
+import javax.jws.WebService;
+import javax.xml.ws.Holder;
+
+import org.apache.cxf.mime.TestMtom;
+
+@WebService(serviceName = "TestMtomService",
+                portName = "TestMtomPort",
+                endpointInterface = "org.apache.cxf.mime.TestMtom",
+                targetNamespace = "http://cxf.apache.org/mime")
+
+public class TestMtomImpl implements TestMtom {
+
+
+    public void testXop(Holder<String> name, Holder<byte[]> attachinfo) {
+        System.out.println("Received image holder data from client");
+        System.out.println("The image holder data length is " + attachinfo.value.length);        
+        name.value = "return detail + " + name.value;        
+    }
+
+}

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/cxf-servlet.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/cxf-servlet.xml?view=auto&rev=478805
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/cxf-servlet.xml (added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/cxf-servlet.xml Fri Nov 24 00:54:41 2006
@@ -0,0 +1,31 @@
+<?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.
+-->
+<endpoints>
+
+    <endpoint
+        name="mtom"
+        interface="org.apache.cxf.mime.Hello"
+        implementation="demo.mtom.server.HelloImpl"
+        wsdl="WEB-INF/wsdl/mtom_xop.wsdl"
+        service="{http://cxf.apache.org/mime}HelloService"
+        port="{http://cxf.apache.org/mime}HelloPort"
+        url-pattern="/mtom" />
+
+</endpoints>

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/cxf-servlet.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/cxf-servlet.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/cxf-servlet.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/mtom_xop.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/mtom_xop.wsdl?view=auto&rev=478805
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/mtom_xop.wsdl (added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/mtom_xop.wsdl Fri Nov 24 00:54:41 2006
@@ -0,0 +1,82 @@
+<?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.
+-->
+<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">
+
+    <wsdl:types>
+        <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://cxf.apache.org/mime/types"
+            xmlns:xmime="http://www.w3.org/2005/05/xmlmime" elementFormDefault="qualified">
+            <complexType name="XopType">
+                <sequence>
+                    <element name="name" type="xsd:string" />
+                    <element name="attachinfo" type="xsd:base64Binary" />
+                </sequence>
+            </complexType>
+            <element name="testXop" type="types:XopType" />
+            <element name="testXopResponse" type="types:XopType" />
+        </schema>
+
+    </wsdl:types>
+
+
+    <wsdl:message name="testXopIn">
+        <wsdl:part name="data" element="types:testXop" />
+    </wsdl:message>
+
+    <wsdl:message name="testXopOut">
+        <wsdl:part name="data" element="types:testXopResponse" />
+    </wsdl:message>
+
+
+    <wsdl:portType name="TestMtom">
+
+        <wsdl:operation name="testXop">
+            <wsdl:input message="tns:testXopIn" />
+            <wsdl:output message="tns:testXopOut" />
+        </wsdl:operation>
+
+    </wsdl:portType>
+
+    <wsdl:binding name="TestMtomBinding" type="tns:TestMtom">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+        <wsdl:operation name="testXop">
+            <soap:operation soapAction="" />
+            <wsdl:input>
+                <soap:body use="literal" />
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal" />
+            </wsdl:output>
+        </wsdl:operation>
+
+    </wsdl:binding>
+
+    <wsdl:service name="TestMtomService">
+        <wsdl:port name="TestMtomPort" binding="tns:TestMtomBinding">
+            <soap:address location="http://localhost:9000/mime-test" />
+        </wsdl:port>
+    </wsdl:service>
+
+</wsdl:definitions>

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/mtom_xop.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/mtom_xop.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/mtom/wsdl/mtom_xop.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

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=478805&r1=478804&r2=478805
==============================================================================
--- 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 Fri Nov 24 00:54:41 2006
@@ -23,6 +23,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
@@ -42,13 +43,14 @@
             headers = new HashMap<String, List<String>>();
             message.put(Message.PROTOCOL_HEADERS, headers);
         }
-        String ct = (String) message.getContextualProperty("Content-Type");
+        String ct = (String)message.getContextualProperty(HttpHeaderHelper
+            .getHeaderKey(HttpHeaderHelper.CONTENT_TYPE));
         if (ct == null) {
             ct = "text/xml";
         }
         List<String> contentType = new ArrayList<String>();
         contentType.add(ct);
-        headers.put("Content-Type", contentType);
+        headers.put(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE), contentType);
     }
 
 }

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=478805&r1=478804&r2=478805
==============================================================================
--- 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 Fri Nov 24 00:54:41 2006
@@ -61,7 +61,7 @@
         String contentType = (String)message.get(Message.CONTENT_TYPE);
 
         LOG.info("URIParameterInterceptor handle message on path [" + path 
-                 + "] with Content-Type ["  + contentType + "]");
+                 + "] with content-type ["  + contentType + "]");
         
         BindingOperationInfo op = message.getExchange().get(BindingOperationInfo.class);
 

Modified: incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestUtil.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestUtil.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestUtil.java Fri Nov 24 00:54:41 2006
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.binding.soap;
 
-import java.awt.Image;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -27,40 +26,36 @@
 import java.util.Collection;
 
 import javax.activation.DataHandler;
-import javax.imageio.ImageIO;
 import javax.mail.util.ByteArrayDataSource;
 
 import org.apache.cxf.binding.attachment.AttachmentImpl;
 import org.apache.cxf.binding.attachment.AttachmentUtil;
-import org.apache.cxf.bindings.soap.attachments.types.DetailType;
 import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.mime.types.XopType;
 
 public final class TestUtil {
 
     private TestUtil() {
     }
 
-    public static DetailType createDetailObject(Class<?> clazz)
+    public static XopType createXopObject(Class<?> clazz)
         throws IOException {
         
-        DetailType detailObj = new DetailType();
-        detailObj.setSName("hello world");        
+        XopType xopObj = new XopType();
+        xopObj.setName("hello world");        
                 
         URL url1 = clazz.getResource("my.wav");
-        URL url2 = clazz.getResource("me.bmp");
-        Image image = ImageIO.read(new File(url2.getFile()));
-        detailObj.setPhoto(image);
         File file = new File(url1.getFile());
         FileInputStream fi = new FileInputStream(file);
         byte[] buffer = new byte[(int) file.length()];
         fi.read(buffer);
-        detailObj.setSound(buffer);
+        xopObj.setAttachinfo(buffer);
         
-        return detailObj;        
+        return xopObj;        
     }
     
     public static SoapMessage createSoapMessage(SoapVersion soapVersion,
@@ -76,11 +71,11 @@
 
         // setup the message attachments
         Collection<Attachment> attachments = soapMessage.getAttachments();
-        String cidAtt1 = "cid:http://cxf.apache.org/me.bmp";
-        bads = new ByteArrayDataSource(clazz.getResourceAsStream("me.bmp"), "image/bmp");
-        AttachmentImpl att1 = new AttachmentImpl(cidAtt1, new DataHandler(bads));
-        att1.setXOP(true);
-        attachments.add(att1);
+//        String cidAtt1 = "cid:http://cxf.apache.org/me.bmp";
+//        bads = new ByteArrayDataSource(clazz.getResourceAsStream("me.bmp"), "image/bmp");
+//        AttachmentImpl att1 = new AttachmentImpl(cidAtt1, new DataHandler(bads));
+//        att1.setXOP(true);
+//        attachments.add(att1);
         String cidAtt2 = "cid:http://cxf.apache.org/my.wav";
         bads = new ByteArrayDataSource(clazz.getResourceAsStream("my.wav"),
                                        "Application/octet-stream");

Modified: incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/attachments/AttachmentTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/attachments/AttachmentTest.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/attachments/AttachmentTest.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/attachments/AttachmentTest.java Fri Nov 24 00:54:41 2006
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.binding.soap.attachments;
 
-import java.awt.Image;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -55,11 +54,13 @@
 import org.apache.cxf.binding.soap.TestBase;
 import org.apache.cxf.binding.soap.TestUtil;
 import org.apache.cxf.binding.soap.interceptor.MultipartMessageInterceptor;
-import org.apache.cxf.bindings.soap.attachments.types.DetailType;
+
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller;
 import org.apache.cxf.jaxb.attachment.JAXBAttachmentUnmarshaller;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.mime.types.XopType;
 
 public class AttachmentTest extends TestBase {
 
@@ -79,7 +80,7 @@
             fail(ioe.getStackTrace().toString());
         }
         InputStream is = soapMessage.getContent(Attachment.class).getDataHandler().getDataSource()
-                        .getInputStream();
+                .getInputStream();
         testHandleMessage(soapMessage, is, true);
     }
 
@@ -90,7 +91,7 @@
             fail(ioe.getStackTrace().toString());
         }
         InputStream is = soapMessage.getContent(Attachment.class).getDataHandler().getDataSource()
-                        .getInputStream();
+                .getInputStream();
         testHandleMessage(soapMessage, is, true);
     }
 
@@ -99,10 +100,10 @@
         try {
             soapMessage = TestUtil.createSoapMessage(Soap12.getInstance(), chain, this.getClass());
             InputStream is = soapMessage.getContent(Attachment.class).getDataHandler().getDataSource()
-                            .getInputStream();
+                    .getInputStream();
             testHandleMessage(soapMessage, is, false);
 
-            JAXBContext context = JAXBContext.newInstance("org.apache.cxf.bindings.soap.attachments.types");
+            JAXBContext context = JAXBContext.newInstance("org.apache.cxf.mime.types");
             Unmarshaller u = context.createUnmarshaller();
 
             JAXBAttachmentUnmarshaller jau = new JAXBAttachmentUnmarshaller(soapMessage);
@@ -111,12 +112,11 @@
             XMLStreamReader r = (XMLStreamReader) soapMessage.getContent(XMLStreamReader.class);
             while (r.hasNext()) {
                 r.nextTag();
-                if (r.getLocalName().equals("Body")) {
-                    r.nextTag();
+                if (r.getLocalName().equals("testXop")) {                    
                     break;
                 }
             }
-            obj = u.unmarshal(r, DetailType.class);
+            obj = u.unmarshal(r);
 
         } catch (UnmarshalException ue) {
             // It's helpful to include the cause in the case of
@@ -136,38 +136,36 @@
         }
 
         assertTrue(obj != null);
-        assertTrue(obj instanceof DetailType);
-        DetailType detailType = (DetailType) obj;
-        assertTrue(detailType.getSName().equals("hello world"));
-        //needs futhur investigation
-        assertTrue(detailType.getPhoto() instanceof Image);
-        assertTrue(detailType.getSound().length > 0);
+        assertTrue(obj instanceof XopType);
+        XopType xopType = (XopType) obj;
+        assertTrue(xopType.getName().equals("hello world"));
+        // needs futhur investigation       
+        assertTrue(xopType.getAttachinfo().length > 0);
     }
 
     public void testDoMarshallXopEnabled() throws Exception {
         // mashalling data object
-        QName elName = new QName("http://cxf.apache.org/bindings/soap/attachments/types", "Detail");
+        QName elName = new QName("http://cxf.apache.org/mime", "testXop");
         soapMessage = TestUtil.createEmptySoapMessage(Soap12.getInstance(), chain);
         try {
-            DetailType detailObj = TestUtil.createDetailObject(this.getClass());
-            Class<?> cls = DetailType.class;
-            JAXBContext context = JAXBContext.newInstance("org.apache.cxf.bindings.soap.attachments.types");
+            XopType xopObj = TestUtil.createXopObject(this.getClass());
+            Class<?> cls = XopType.class;
+            JAXBContext context = JAXBContext.newInstance("org.apache.cxf.mime.types");
             Marshaller m = context.createMarshaller();
 
             JAXBAttachmentMarshaller jam = new JAXBAttachmentMarshaller(soapMessage);
             jam.setXOPPackage(true);
             m.setAttachmentMarshaller(jam);
 
-            Object mObj = detailObj;
+            Object mObj = xopObj;
 
             CachedOutputStream cosXml = new CachedOutputStream();
             XMLOutputFactory output = XMLOutputFactory.newInstance();
             XMLStreamWriter writer = output.createXMLStreamWriter(cosXml);
 
             if (null != cls && !cls.isAnnotationPresent(XmlRootElement.class)) {
-                mObj = JAXBElement.class.getConstructor(
-                                new Class[] {QName.class, Class.class, Object.class}).newInstance(elName,
-                                cls, mObj);
+                mObj = JAXBElement.class.getConstructor(new Class[]{QName.class, Class.class, Object.class})
+                        .newInstance(elName, cls, mObj);
             }
             // No envelop & body generated!
             m.marshal(mObj, writer);
@@ -204,19 +202,20 @@
             Map<String, List<String>> mimeHttpHeaders = new HashMap<String, List<String>>();
             soapMessage.put(Message.PROTOCOL_HEADERS, mimeHttpHeaders);
             StringTokenizer stk = new StringTokenizer(contentType, ";");
-            List<String> headers = new ArrayList<String>(); 
+            List<String> headers = new ArrayList<String>();
             while (stk.hasMoreTokens()) {
                 headers.add(stk.nextToken().trim());
             }
-            mimeHttpHeaders.put("Content-Type", headers);
+            mimeHttpHeaders.put(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE), headers);
             mimeHttpHeaders.put("Content-Description", Arrays.asList("XML document Multi-Media attachment"));
 
             soapMessage.getInterceptorChain().doIntercept(soapMessage);
 
             Attachment primarySoapPart = (Attachment) soapMessage.getContent(Attachment.class);
-            String ct = primarySoapPart.getHeader("Content-Type");
+            String ct = primarySoapPart.getHeader(HttpHeaderHelper
+                    .getHeaderKey(HttpHeaderHelper.CONTENT_TYPE));
             assertTrue("type header determined by Soap Version", ct.indexOf(soapMessage.getVersion()
-                            .getSoapMimeType()) >= 0);
+                    .getSoapMimeType()) >= 0);
             assertTrue(primarySoapPart.getDataHandler() != null);
 
             XMLStreamReader xsr = (XMLStreamReader) soapMessage.getContent(XMLStreamReader.class);
@@ -234,7 +233,7 @@
                 while (xsr.hasNext()) {
                     xsr.nextTag();
                     // System.out.println(xsr.getName());
-                    if (xsr.getName().getLocalPart().equals("Detail")) {
+                    if (xsr.getName().getLocalPart().equals("testXop")) {
                         found = true;
                         break;
                     }
@@ -244,15 +243,11 @@
             AttachmentDeserializer ad = soapMessage.get(AttachmentDeserializer.class);
             ad.processAttachments();
             Collection<Attachment> attachments = soapMessage.getAttachments();
-            assertTrue(attachments.size() == 2);
+            assertTrue(attachments.size() == 1);
             Iterator<Attachment> it = attachments.iterator();
             Attachment att1 = it.next();
             assertTrue(att1.getId() != null);
             assertTrue(att1.getDataHandler() != null);
-
-            Attachment att2 = it.next();
-            assertTrue(att2.getId() != null);
-            assertTrue(att2.getDataHandler() != null);
 
         } catch (XMLStreamException xse) {
             fail(xse.getStackTrace().toString());

Modified: incubator/cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/attachments/primarySoapPart.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/attachments/primarySoapPart.xml?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/attachments/primarySoapPart.xml (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/attachments/primarySoapPart.xml Fri Nov 24 00:54:41 2006
@@ -1,35 +1,30 @@
 <!--
-  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.
+    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.
 -->
-<soap:Envelope xmlns:soap='http://www.w3.org/2003/05/soap-envelope'
-	xmlns="http://cxf.apache.org/bindings/soap/attachments/types"
-	xmlns:xmlmime='http://www.w3.org/2004/11/xmlmime'>
-	<soap:Body>
-		<Detail xmlns:m='http://example.org/stuff'>
-			<sName>hello world</sName>
-			<photo xmlmime:contentType='image/bmp'>
-				<xop:Include xmlns:xop='http://www.w3.org/2004/08/xop/include'
-					href='cid:http://cxf.apache.org/me.bmp'/>
-			</photo>
-			<sound xmlmime:contentType='audio/x-wav'>
-				<xop:Include xmlns:xop='http://www.w3.org/2004/08/xop/include'
-					href='cid:http://cxf.apache.org/my.wav'/>
-			</sound>
-		</Detail>
-	</soap:Body>
+<soap:Envelope xmlns:soap='http://www.w3.org/2003/05/soap-envelope' xmlns="http://cxf.apache.org/mime/types"
+    xmlns:xop='http://www.w3.org/2004/08/xop/include' xmlns:xmlmime='http://www.w3.org/2004/11/xmlmime'>
+    <soap:Body>
+        <testXop xmlns="http://cxf.apache.org/mime/types">
+            <name>hello world</name>
+            <attachinfo>
+                <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include"
+                    href='cid:http://cxf.apache.org/my.wav' />
+            </attachinfo>
+        </testXop>
+    </soap:Body>
 </soap:Envelope>

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentDeserializer.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentDeserializer.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentDeserializer.java Fri Nov 24 00:54:41 2006
@@ -25,19 +25,24 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
 import javax.activation.DataHandler;
 import javax.activation.DataSource;
+
 import javax.mail.Header;
 import javax.mail.MessagingException;
 import javax.mail.internet.InternetHeaders;
 
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.io.AbstractCachedOutputStream;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Message;
 
+
 public class AttachmentDeserializer {
 
     public static final String ATTACHMENT_DIRECTORY = "attachment-directory";
@@ -60,16 +65,17 @@
         message = messageParam;
     }
 
+    
     public boolean preprocessMessage() {
         InputStream input;
-        Map httpHeaders;
+        Map<String, List<String>> httpHeaders;
         // processing message if its multi-part/form-related
         try {
-            httpHeaders = (Map) message.get(Message.PROTOCOL_HEADERS);
+            httpHeaders = (Map<String, List<String>>) message.get(Message.PROTOCOL_HEADERS);
             if (httpHeaders == null) {
                 return false;
             } else {
-                List ctList = (List) httpHeaders.get("Content-Type");
+                List ctList = (List) HttpHeaderHelper.getHeader(httpHeaders, HttpHeaderHelper.CONTENT_TYPE);
                 if (ctList != null) {
                     for (int x = 0; x < ctList.size(); x++) {
                         if (x == 0) {
@@ -222,33 +228,50 @@
             return null;
         }
         stream.unread(v);
-        InternetHeaders headers;
-        headers = new InternetHeaders(stream);
+        InternetHeaders iheaders = new InternetHeaders(stream);
+        Map<String, List<String>> internalHeaders = new HashMap<String, List<String>>(); 
+        for (Enumeration e = iheaders.getAllHeaders(); e.hasMoreElements();) {
+            Header header = (Header)e.nextElement();            
+            List<String> values = new ArrayList<String>();
+            String headerName = HttpHeaderHelper.getHeaderKey(header.getName());
+            internalHeaders.put(headerName, values);
+            values.add(header.getValue());
+        }
         MimeBodyPartInputStream partStream = new MimeBodyPartInputStream(stream, boundary.getBytes());
         final CachedOutputStream cos = new CachedOutputStream();
         cos.setThreshold(THRESHHOLD);
         AbstractCachedOutputStream.copyStream(partStream, cos, THRESHHOLD);
-        cos.close();
-        final String ct = headers.getHeader("Content-Type", null);
+        cos.close();        
+        final String ct = constructHeaderValue(HttpHeaderHelper.getHeader(internalHeaders, 
+                HttpHeaderHelper.CONTENT_TYPE));
         cache.add(cos);
         DataSource source = new AttachmentDataSource(ct, cos);
         DataHandler dh = new DataHandler(source);
-        String id = headers.getHeader("Content-ID", null);
+        String id = internalHeaders.get(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_ID)).get(0);
         if (id != null && id.startsWith("<")) {
             id = id.substring(1, id.length() - 1);
         }
         AttachmentImpl att = new AttachmentImpl(id, dh);
-        for (Enumeration<?> e = headers.getAllHeaders(); e.hasMoreElements();) {
-            Header header = (Header) e.nextElement();
-            if (header.getName().equalsIgnoreCase("Content-Transfer-Encoding")
-                            && header.getValue().equalsIgnoreCase("binary")) {
+        for (Iterator<String> it = internalHeaders.keySet().iterator(); it.hasNext();) {
+            String headerName = it.next();
+            List values = internalHeaders.get(headerName);
+            if (headerName.equalsIgnoreCase("Content-Transfer-Encoding")
+                            && values.size() == 1 && values.get(0).equals("binary")) {
                 att.setXOP(true);
             }
-            att.setHeader(header.getName(), header.getValue());
+            att.setHeader(headerName, constructHeaderValue(values));
         }
         return att;
     }
 
+    private static String constructHeaderValue(List values) {
+        StringBuffer sb = new StringBuffer(200);
+        for (int i = 0; i < values.size(); i++) {
+            sb.append(values.get(i));
+        }
+        return sb.toString();
+    }
+    
     private class MimeBodyPartInputStream extends InputStream {
 
         PushbackInputStream inStream;

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentSerializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentSerializer.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentSerializer.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentSerializer.java Fri Nov 24 00:54:41 2006
@@ -28,11 +28,13 @@
 import java.util.Map;
 
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.io.AbstractCachedOutputStream;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Message;
 
+
 public class AttachmentSerializer {
 
     private static final String LINE_SEP = System.getProperty("line.separator");
@@ -110,7 +112,8 @@
             out.write(LINE_SEP.getBytes());
             out.flush();            
             // build contentType string for return
-            List<String> contentType = (List<String>) headers.get("Content-Type");
+            List<String> contentType = (List<String>) headers.get(HttpHeaderHelper.getHeaderKey(
+                    HttpHeaderHelper.CONTENT_TYPE));
             StringBuffer sb = new StringBuffer(120);
             for (String s : contentType) {
                 sb.append(s);

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentUtil.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentUtil.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentUtil.java Fri Nov 24 00:54:41 2006
@@ -29,6 +29,7 @@
 import java.util.Map;
 import java.util.UUID;
 
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Message;
 
@@ -65,7 +66,7 @@
         StringBuffer s = new StringBuffer();
         // Unique string is ----=_Part_<part>_<hashcode>.<currentTime>
         s.append("----=_Part_").append(part++).append("_").append(s.hashCode()).append('.').append(
-                        System.currentTimeMillis());
+                System.currentTimeMillis());
         return s.toString();
     }
 
@@ -74,14 +75,15 @@
         if (System.getProperty("file.separator").equals("/")) {
             buffer.append("\n");
         }
-        buffer.append("Content-Type: application/xop+xml; charset=utf-8; ");
+        buffer.append(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE)
+                + ": application/xop+xml; charset=utf-8; ");
         buffer.append("type=\"" + message.getAttachmentMimeType());
         if (action != null) {
             buffer.append("; action=" + action + "\"\n");
         } else {
             buffer.append("\"\n");
         }
-        buffer.append("Content-Transfer-Encoding: binary\n");        
+        buffer.append("Content-Transfer-Encoding: binary\n");
         buffer.append("Content-ID: <" + soapPartId + ">\n");
         return buffer.toString();
     }
@@ -91,7 +93,8 @@
         if (System.getProperty("file.separator").equals("/")) {
             buffer.append("\n");
         }
-        buffer.append("Content-Type: " + att.getDataHandler().getContentType() + ";\n");
+        buffer.append(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE) + ": "
+                + att.getDataHandler().getContentType() + ";\n");
         if (att.isXOP()) {
             buffer.append("Content-Transfer-Encoding: binary\n");
         }
@@ -100,13 +103,13 @@
     }
 
     public static void setMimeRequestHeader(Map<String, List<String>> reqHeaders, Message message,
-                    String soapPartId, String contentDesc, String boundary) {
+            String soapPartId, String contentDesc, String boundary) {
         List<String> header1 = new ArrayList<String>();
         header1.add("1.0");
         reqHeaders.put("MIME-Version", header1);
         List<String> header2 = new ArrayList<String>();
         header2.add("Multipart/" + getMimeSubType(message, soapPartId, boundary));
-        reqHeaders.put("Content-Type", header2);
+        reqHeaders.put(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE), header2);
         List<String> header3 = new ArrayList<String>();
         header3.add(contentDesc);
         reqHeaders.put("Content-Description", header3);

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainIntiatorObserver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainIntiatorObserver.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainIntiatorObserver.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainIntiatorObserver.java Fri Nov 24 00:54:41 2006
@@ -52,8 +52,8 @@
         
         faultMessage = m.getExchange().get(Binding.class).createMessage(faultMessage);
         setFaultMessage(m, faultMessage);
-        m.putAll(faultMessage);
-        faultMessage.putAll(m);
+        //m.putAll(faultMessage);
+        //faultMessage.putAll(m);
 
         MessageImpl.copyContent(m, faultMessage);
         

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainSetupInterceptor.java Fri Nov 24 00:54:41 2006
@@ -29,6 +29,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
@@ -88,7 +89,7 @@
         LOG.info("OutgoingChainSetupInterceptor set the content-type to: " 
                  + message.get(Message.CONTENT_TYPE));
 
-        headers.put("Content-Type",  
+        headers.put(HttpHeaderHelper.CONTENT_TYPE,  
                     Arrays.asList(new String[] {(String)message.get(Message.CONTENT_TYPE)}));
     }
     

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller.java Fri Nov 24 00:54:41 2006
@@ -31,6 +31,7 @@
 
 import org.apache.cxf.binding.attachment.AttachmentDeserializer;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Message;
@@ -83,15 +84,16 @@
 
     @Override
     public boolean isXOPPackage() {
-        String contentTypeOfSoapBodyPart;        
+        String contentTypeOfSoapBodyPart;
         Attachment primaryMimePart = message.getContent(Attachment.class);
         if (primaryMimePart == null) {
             return false;
         } else {
-            contentTypeOfSoapBodyPart = primaryMimePart.getHeader("Content-Type");
+            contentTypeOfSoapBodyPart = primaryMimePart.getHeader(HttpHeaderHelper
+                    .getHeaderKey(HttpHeaderHelper.CONTENT_TYPE));
         }
         if (contentTypeOfSoapBodyPart != null
-                        && contentTypeOfSoapBodyPart.indexOf("application/xop+xml") >= 0) {
+                && contentTypeOfSoapBodyPart.indexOf("application/xop+xml") >= 0) {
 
             if (contentTypeOfSoapBodyPart.indexOf("application/soap+xml") >= 0) {
                 return true;
@@ -109,10 +111,10 @@
             att = ad.getAttachment(contentId);
         } catch (MessagingException me) {
             throw new Fault(new org.apache.cxf.common.i18n.Message("FAILED_GETTING_ATTACHMENT", LOG,
-                            contentId), me);
+                    contentId), me);
         } catch (IOException ioe) {
             throw new Fault(new org.apache.cxf.common.i18n.Message("FAILED_GETTING_ATTACHMENT", LOG,
-                            contentId), ioe);
+                    contentId), ioe);
         }
         if (att == null) {
             throw new IllegalArgumentException("Attachment " + contentId + " was not found.");

Modified: 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=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletController.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/servlet/ServletController.java Fri Nov 24 00:54:41 2006
@@ -41,6 +41,7 @@
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -93,7 +94,7 @@
                 }
             } else if (wsdl) {
                 generateWSDL(request, res, d);
-            } else {
+            } else {                
                 invokeDestination(request, res, d);
             }
         } catch (IOException e) {
@@ -103,7 +104,7 @@
 
     private void generateXSD(HttpServletRequest request, HttpServletResponse response, String xsdName) 
         throws ServletException {
-        response.setHeader("Content-Type", "text/xml");
+        response.setHeader(HttpHeaderHelper.CONTENT_TYPE, "text/xml");
         try {
             OutputStream os = response.getOutputStream();
                  
@@ -138,7 +139,7 @@
             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);
@@ -150,7 +151,7 @@
                                 HttpServletResponse response, 
                                 ServletDestination d)
         throws ServletException {
-        response.setHeader("Content-Type", "text/xml");
+        response.setHeader(HttpHeaderHelper.CONTENT_TYPE, "text/xml");
 
         try {
             OutputStream os = response.getOutputStream();

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=478805&r1=478804&r2=478805
==============================================================================
--- 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 Fri Nov 24 00:54:41 2006
@@ -24,18 +24,22 @@
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.util.Base64Exception;
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.io.AbstractWrappedOutputStream;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
@@ -213,11 +217,24 @@
      * @param message the current message
      * @param headers the current set of headers
      */
-    protected void copyRequestHeaders(Message message,
-                                      Map<String, List<String>> headers) {
-        
-    }
-    
+    protected void copyRequestHeaders(Message message, Map<String, List<String>> headers) {
+        HttpServletRequest req = (HttpServletRequest)message.get(HTTP_REQUEST);
+        for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
+            String fname = (String)e.nextElement();
+            
+            List<String> values;
+            if (headers.containsKey(fname)) {
+                values = headers.get(fname);
+            } else {
+                values = new ArrayList<String>();
+                headers.put(HttpHeaderHelper.getHeaderKey(fname), values);
+            }
+            for (Enumeration e2 = req.getHeaders(fname); e2.hasMoreElements();) {
+                String val = (String)e2.nextElement();
+                values.add(val);
+            }
+        }
+    }    
     /**
      * Copy the response headers into the response.
      * 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HolderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HolderTest.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HolderTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HolderTest.java Fri Nov 24 00:54:41 2006
@@ -21,7 +21,7 @@
 import org.w3c.dom.Node;
 import org.apache.cxf.Bus;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
-import org.apache.cxf.mtom_xop.HelloImpl;
+import org.apache.cxf.mtom_xop.TestMtomImpl;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.factory.ServerFactoryBean;
 import org.apache.cxf.transport.local.LocalTransportFactory;
@@ -34,10 +34,10 @@
 
         Bus bus = getBus();
         bean.setBus(bus);
-        bean.setServiceClass(HelloImpl.class);
+        bean.setServiceClass(TestMtomImpl.class);
         
         Service service = bean.create();
-        service.setInvoker(new JAXWSMethodInvoker(new HelloImpl()));
+        service.setInvoker(new JAXWSMethodInvoker(new TestMtomImpl()));
         
         ServerFactoryBean svr = new ServerFactoryBean();
         svr.setBus(bus);
@@ -47,9 +47,9 @@
         Node response = invoke("http://localhost:9036/mime-test",
                                LocalTransportFactory.TRANSPORT_ID, 
                                "echoData.xml");
-        addNamespace("h", "http://cxf.apache.org/mime");        
+        addNamespace("h", "http://cxf.apache.org/mime/types");        
         
-        assertValid("//h:data", response);        
+        assertValid("//h:name", response);        
         assertValid("/s:Envelope/s:Body", response); 
         assertNotNull(response);
         assertNoFault(response);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JAXWSMethodInvokerTest.java Fri Nov 24 00:54:41 2006
@@ -21,8 +21,9 @@
 import junit.framework.TestCase;
 
 import org.apache.cxf.common.util.factory.Factory;
+import org.apache.cxf.jaxws.service.Hello;
 import org.apache.cxf.message.Exchange;
-import org.apache.cxf.mime.Hello;
+
 import org.apache.cxf.service.invoker.ScopePolicy;
 import org.easymock.classextension.EasyMock;
 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/echoData.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/echoData.xml?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/echoData.xml (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/echoData.xml Fri Nov 24 00:54:41 2006
@@ -1,24 +1,27 @@
 <!--
-  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.
+    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.
 -->
 <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
-  <s:Body>
-    <body xmlns="http://cxf.apache.org/mime/types">Hi</body>
-    <data xmlns="http://cxf.apache.org/mime">foo</data>
-  </s:Body>
+    <s:Body>
+        <testXop xmlns:ns2="http://www.w3.org/2005/08/addressing/wsdl"
+            xmlns="http://cxf.apache.org/mime/types">
+            <name>call detail</name>
+            <attachinfo>byte data</attachinfo>
+        </testXop>
+    </s:Body>
 </s:Envelope>

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBeanTest.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBeanTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBeanTest.java Fri Nov 24 00:54:41 2006
@@ -27,7 +27,8 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.jaxws.AbstractJaxWsTest;
-import org.apache.cxf.mtom_xop.HelloImpl;
+import org.apache.cxf.mime.types.XopType;
+import org.apache.cxf.mtom_xop.TestMtomImpl;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.invoker.BeanInvoker;
 import org.apache.cxf.service.model.FaultInfo;
@@ -87,22 +88,24 @@
 
         Bus bus = getBus();
         bean.setBus(bus);
-        bean.setServiceClass(HelloImpl.class);
+        bean.setServiceClass(TestMtomImpl.class);
 
         Service service = bean.create();
         InterfaceInfo intf = service.getServiceInfo().getInterface();
         
         OperationInfo op = intf.getOperation(
-            new QName("http://cxf.apache.org/mime", "echoData"));
+            new QName("http://cxf.apache.org/mime", "testXop"));
         assertNotNull(op);
         
         // test setup of input parts
         Iterator<MessagePartInfo> itr = op.getInput().getMessageParts().iterator();
         assertTrue(itr.hasNext());
         MessagePartInfo part = itr.next();
-        assertEquals("body", part.getName().getLocalPart());
-        assertEquals(String.class, part.getTypeClass());
-        
+        assertEquals("data", part.getName().getLocalPart());
+        assertEquals(XopType.class, part.getTypeClass());
+
+        /*
+         * revisit, try to use other wsdl operation rewrite test in future 
         assertTrue(itr.hasNext());
         part = itr.next();
         assertEquals(Boolean.TRUE, part.getProperty(JaxWsServiceFactoryBean.MODE_INOUT));
@@ -116,7 +119,7 @@
         assertTrue(itr.hasNext());
         part = itr.next();
         assertEquals(Boolean.TRUE, part.getProperty(JaxWsServiceFactoryBean.MODE_INOUT));
-        
+        */
         assertFalse(itr.hasNext());
     }
 }

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Fri Nov 24 00:54:41 2006
@@ -35,6 +35,7 @@
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.ConfigurationProvider;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.ConduitInitiator;
@@ -200,7 +201,7 @@
                         Arrays.asList(new String[] {policy.getContentEncoding()}));
         }
         if (policy.isSetContentType()) {
-            headers.put("Content-Type",
+            headers.put(HttpHeaderHelper.CONTENT_TYPE,
                         Arrays.asList(new String[] {policy.getContentType()}));
         }
         if (policy.isSetServerType()) {

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java Fri Nov 24 00:54:41 2006
@@ -43,6 +43,7 @@
 import org.apache.cxf.configuration.ConfigurationProvider;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.io.AbstractWrappedOutputStream;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
@@ -184,9 +185,10 @@
         connection.setUseCaches(false);
         
         if (null != message.get(Message.CONTENT_TYPE)) {
-            connection.setRequestProperty("Content-Type", (String)message.get(Message.CONTENT_TYPE));
+            connection.setRequestProperty(HttpHeaderHelper.CONTENT_TYPE, 
+                    (String)message.get(Message.CONTENT_TYPE));
         } else {
-            connection.setRequestProperty("Content-Type", "text/xml");
+            connection.setRequestProperty(HttpHeaderHelper.CONTENT_TYPE, "text/xml");
         }
         
         if (connection instanceof HttpURLConnection) {
@@ -320,7 +322,7 @@
      */
     private Map<String, List<String>> setHeaders(Message message) {
         Map<String, List<String>> headers =
-            CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS));
+            CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS));        
         if (null == headers) {
             headers = new HashMap<String, List<String>>();
             message.put(Message.PROTOCOL_HEADERS, headers);
@@ -467,7 +469,11 @@
             Message inMessage = new MessageImpl();
             inMessage.setExchange(exchange);
             InputStream in = null;
-            inMessage.put(Message.PROTOCOL_HEADERS, connection.getHeaderFields());
+            Map<String, List<String>> headers = new HashMap<String, List<String>>();
+            for (String key : connection.getHeaderFields().keySet()) {
+                headers.put(HttpHeaderHelper.getHeaderKey(key), connection.getHeaderFields().get(key));
+            }
+            inMessage.put(Message.PROTOCOL_HEADERS, headers);
             inMessage.put(Message.RESPONSE_CODE, responseCode);
             if (connection instanceof HttpURLConnection) {
                 HttpURLConnection hc = (HttpURLConnection)connection;
@@ -703,7 +709,7 @@
                         Arrays.asList(new String[] {policy.getAcceptLanguage()}));
         }
         if (policy.isSetContentType()) {
-            headers.put("Content-Type",
+            headers.put(HttpHeaderHelper.CONTENT_TYPE,
                         Arrays.asList(new String[] {policy.getContentType()}));
         }
         if (policy.isSetCookie()) {

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java Fri Nov 24 00:54:41 2006
@@ -37,6 +37,7 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.io.AbstractWrappedOutputStream;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -205,7 +206,7 @@
                 values = headers.get(fname);
             } else {
                 values = new ArrayList<String>();
-                headers.put(fname, values);
+                headers.put(HttpHeaderHelper.getHeaderKey(fname), values);
             }
             for (Enumeration e2 = req.getFieldValues(fname); e2.hasMoreElements();) {
                 String val = (String)e2.nextElement();
@@ -244,7 +245,7 @@
         if ("GET".equals(req.getMethod()) && req.getURI().toString().toLowerCase().endsWith("?wsdl")) {
             try {
 
-                resp.addField("Content-Type", "text/xml");
+                resp.addField(HttpHeaderHelper.CONTENT_TYPE, "text/xml");
 
                 OutputStream os = resp.getOutputStream();
 

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java?view=diff&rev=478805&r1=478804&r2=478805
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java Fri Nov 24 00:54:41 2006
@@ -320,9 +320,8 @@
         wrappedOS.close();
         
         assertNotNull("expected in message", inMessage);
-        assertSame("unexpected response headers",
-                   inMessage.get(Message.PROTOCOL_HEADERS), 
-                   Collections.EMPTY_MAP);
+        Map<?, ?> headerMap = (Map<?, ?>) inMessage.get(Message.PROTOCOL_HEADERS);
+        assertEquals("unexpected response headers", headerMap.size(), 0);
         Integer expectedResponseCode = decoupled 
                                        ? HttpURLConnection.HTTP_ACCEPTED
                                        : HttpURLConnection.HTTP_OK;