cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r436639 - in /incubator/cxf/trunk/rt/core/src: main/java/org/apache/cxf/binding/attachment/ test/resources/org/apache/cxf/interceptor/resources/
Date Fri, 25 Aug 2006 04:14:00 GMT
Author: dandiep
Date: Thu Aug 24 21:13:58 2006
New Revision: 436639

URL: http://svn.apache.org/viewvc?rev=436639&view=rev
Log:
Force SVN to add missing files.

Added:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentDataSource.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentImpl.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/binding/attachment/ByteDataSource.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/CachedOutputStream.java
    incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/interceptor/resources/
    incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/interceptor/resources/sayHiDocLitBareReq.xml
    incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/interceptor/resources/sayHiDocLitBareResp.xml

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentDataSource.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentDataSource.java?rev=436639&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentDataSource.java
(added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentDataSource.java
Thu Aug 24 21:13:58 2006
@@ -0,0 +1,41 @@
+package org.apache.cxf.binding.attachment;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.activation.DataSource;
+
+public class AttachmentDataSource implements DataSource {
+
+    private final String ct;
+    private final InputStream in;
+
+    public AttachmentDataSource(String ctParam, CachedOutputStream cosParam) throws IOException
{
+        this.ct = ctParam;
+        this.in = cosParam.getInputStream();
+    }
+
+    public AttachmentDataSource(String ctParam, InputStream inParam) {
+        this.ct = ctParam;
+        this.in = inParam;
+    }
+
+    public String getContentType() {
+        return ct;
+    }
+
+    public InputStream getInputStream() {
+        return in;
+    }
+
+    public String getName() {
+        return null;
+    }
+
+    public OutputStream getOutputStream() throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+
+}

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentImpl.java?rev=436639&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentImpl.java
(added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentImpl.java
Thu Aug 24 21:13:58 2006
@@ -0,0 +1,51 @@
+package org.apache.cxf.binding.attachment;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.activation.DataHandler;
+
+import org.apache.cxf.message.Attachment;
+
+public class AttachmentImpl implements Attachment {
+
+    private DataHandler handler;
+    private String id;
+    private Map<String, String> headers = new HashMap<String, String>();
+    private boolean xop;
+
+    public AttachmentImpl(String idParam, DataHandler handlerParam) {
+        this.id = idParam;
+        this.handler = handlerParam;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public DataHandler getDataHandler() {
+        return handler;
+    }
+
+    public void setHeader(String name, String value) {
+        headers.put(name, value);
+    }
+
+    public String getHeader(String name) {
+        return headers.get(name);
+    }
+    
+    public Iterator<String> getHeaderNames() {
+        return headers.keySet().iterator();
+    }
+
+    public boolean isXOP() {
+        return xop;
+    }
+
+    public void setXOP(boolean xopParam) {
+        this.xop = xopParam;
+    }
+
+}

Added: 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?rev=436639&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentUtil.java
(added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/AttachmentUtil.java
Thu Aug 24 21:13:58 2006
@@ -0,0 +1,85 @@
+package org.apache.cxf.binding.attachment;
+
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URLEncoder;
+import java.util.UUID;
+
+import javax.xml.ws.WebServiceException;
+
+import org.apache.cxf.message.Message;
+
+public final class AttachmentUtil {
+
+    private AttachmentUtil() {
+
+    }
+
+    /**
+     * @param ns
+     * @return
+     */
+    public static String createContentID(String ns) {
+        // tend to change
+        String cid = "cxf.apache.org";
+        String name = UUID.randomUUID() + "@";
+        if (ns != null && (ns.length() > 0)) {
+            try {
+                URI uri = new URI(ns);
+                String host = uri.toURL().getHost();
+                cid = host;
+            } catch (URISyntaxException e) {
+                e.printStackTrace();
+                return null;
+            } catch (MalformedURLException e) {
+                try {
+                    cid = URLEncoder.encode(ns, "UTF-8");
+                } catch (UnsupportedEncodingException e1) {
+                    throw new WebServiceException("Encoding content id with namespace error",
e);
+                }
+            }
+        }
+        return name + cid;
+    }
+
+    public static String getUniqueBoundaryValue(int part) {
+        StringBuffer s = new StringBuffer();
+        // Unique string is ----=_Part_<part>_<hashcode>.<currentTime>
+        s.append("----=_Part_").append(part++).append("_").append(s.hashCode()).append('.')
+            .append(System.currentTimeMillis());
+        return s.toString();
+    }
+
+    public static String getMimePartHeader(Message message, String soapPartId, String action)
{
+        StringBuffer buffer = new StringBuffer(200);
+        buffer.append("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");
+        buffer.append("Content-ID: <" + soapPartId + ">");
+        return buffer.toString();
+    }
+
+    public static String getMimeRequestHeader(Message message, String soapPartId, String
contentDesc) {
+        StringBuffer buffer = new StringBuffer(200);
+        buffer.append("MIME-Version: 1.0\n");
+        buffer.append("Content-Type: Multipart/" + getMimeSubType(message, soapPartId) +
"\n");
+        buffer.append("Content-Description: " + contentDesc + "\n");
+        return buffer.toString();
+    }
+
+    public static String getMimeSubType(Message message, String soapPartId) {
+        StringBuffer ct = new StringBuffer();
+        ct.append("related; ");
+        ct.append("type=\"application/xop+xml\"; ");
+        ct.append("start=\"<" + soapPartId + ">\"; ");
+        ct.append("start-info=\"" + message.getAttachmentMimeType() + "\"");
+        return ct.toString();
+    }
+}

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/ByteDataSource.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/ByteDataSource.java?rev=436639&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/ByteDataSource.java
(added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/ByteDataSource.java
Thu Aug 24 21:13:58 2006
@@ -0,0 +1,59 @@
+package org.apache.cxf.binding.attachment;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.activation.DataSource;
+
+public class ByteDataSource implements DataSource {
+    private String contentType;
+    private String name;
+    private byte[] data;
+    private int offset;
+    private int length;
+
+    public ByteDataSource(byte[] dataParam) {
+        this(dataParam, 0, dataParam.length);
+    }
+
+    public ByteDataSource(byte[] dataParam, int offsetParam, int lengthParam) {
+        this.data = dataParam;
+        this.offset = offsetParam;
+        this.length = lengthParam;
+    }
+
+    public byte[] getData() {
+        return data;
+    }
+
+    public void setData(byte[] dataParam) {
+        this.data = dataParam;
+    }
+
+    public void setContentType(String contentTypeParam) {
+        this.contentType = contentTypeParam;
+    }
+
+    public void setName(String nameParam) {
+        this.name = nameParam;
+    }
+
+    public String getContentType() {
+        return contentType;
+    }
+
+    public InputStream getInputStream() throws IOException {
+        return new ByteArrayInputStream(data, offset, length);
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public OutputStream getOutputStream() throws IOException {
+        return null;
+    }
+
+}

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/CachedOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/CachedOutputStream.java?rev=436639&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/CachedOutputStream.java
(added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/attachment/CachedOutputStream.java
Thu Aug 24 21:13:58 2006
@@ -0,0 +1,22 @@
+package org.apache.cxf.binding.attachment;
+
+import java.io.IOException;
+
+import org.apache.cxf.transport.AbstractCachedOutputStream;
+
+public class CachedOutputStream extends AbstractCachedOutputStream {
+
+    public CachedOutputStream() throws IOException {
+        super();
+    }
+
+    public void onWrite() throws IOException {
+    }
+
+    public void doClose() {
+    }
+
+    public void doFlush() {
+    }
+
+}

Added: incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/interceptor/resources/sayHiDocLitBareReq.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/interceptor/resources/sayHiDocLitBareReq.xml?rev=436639&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/interceptor/resources/sayHiDocLitBareReq.xml
(added)
+++ incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/interceptor/resources/sayHiDocLitBareReq.xml
Thu Aug 24 21:13:58 2006
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
+		   xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+		   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <SOAP-ENV:Body>
+	<ns4:inout xmlns:ns4="http://apache.org/hello_world_doc_lit_bare/types" 
+		   xmlns:ns5="http://www.w3.org/2005/08/addressing/wsdl">
+	    <ns4:tickerSymbol>CXF</ns4:tickerSymbol>
+	    <ns4:tickerPrice>1.0</ns4:tickerPrice>
+	</ns4:inout>
+    </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
\ No newline at end of file

Added: incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/interceptor/resources/sayHiDocLitBareResp.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/interceptor/resources/sayHiDocLitBareResp.xml?rev=436639&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/interceptor/resources/sayHiDocLitBareResp.xml
(added)
+++ incubator/cxf/trunk/rt/core/src/test/resources/org/apache/cxf/interceptor/resources/sayHiDocLitBareResp.xml
Thu Aug 24 21:13:58 2006
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
+		   xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+		   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <SOAP-ENV:Body>
+	<ns5:inout xmlns:ns4="http://www.w3.org/2005/08/addressing/wsdl" 
+		   xmlns:ns5="http://apache.org/hello_world_doc_lit_bare/types">
+	    <ns5:tickerSymbol>OBJECTWEB</ns5:tickerSymbol>
+	    <ns5:tickerPrice>4.5</ns5:tickerPrice>
+	</ns5:inout>
+    </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>



Mime
View raw message