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/27 10:02:04 UTC
svn commit: r479552 - in /incubator/cxf/trunk/rt:
bindings/soap/src/main/java/org/apache/cxf/binding/soap/
core/src/main/java/org/apache/cxf/binding/attachment/
Author: tli
Date: Mon Nov 27 01:02:03 2006
New Revision: 479552
URL: http://svn.apache.org/viewvc?view=rev&rev=479552
Log:
fix the crlf problem in construction of mime message
Modified:
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.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
Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java?view=diff&rev=479552&r1=479551&r2=479552
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java Mon Nov 27 01:02:03 2006
@@ -62,7 +62,7 @@
}
public String getSoapMimeType() {
- return "text/xml; charset=utf-8";
+ return "\"text/xml\"; charset=utf-8";
}
public double getVersion() {
Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java?view=diff&rev=479552&r1=479551&r2=479552
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java Mon Nov 27 01:02:03 2006
@@ -63,7 +63,7 @@
}
public String getSoapMimeType() {
- return "application/soap+xml; charset=utf-8";
+ return "\"application/soap+xml\"; charset=utf-8";
}
public double getVersion() {
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=479552&r1=479551&r2=479552
==============================================================================
--- 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 Mon Nov 27 01:02:03 2006
@@ -37,8 +37,6 @@
public class AttachmentSerializer {
- private static final String LINE_SEP = System.getProperty("line.separator");
-
private Message message;
private InputStream in;
@@ -84,18 +82,13 @@
out.flush();
String soapHeader = AttachmentUtil.getSoapPartHeader(message, soapPartId, "");
- out.write(("--" + boundary + LINE_SEP).getBytes());
- out.write(soapHeader.getBytes());
- out.write(LINE_SEP.getBytes());
+ out.write(("--" + boundary + "\r\n").getBytes());
+ out.write(soapHeader.getBytes());
AbstractCachedOutputStream.copyStream(in, out, 64 * 1024);
- if (!System.getProperty("file.separator").equals("/")) {
- out.write(LINE_SEP.getBytes());
- }
for (Attachment att : message.getAttachments()) {
soapHeader = AttachmentUtil.getAttchmentPartHeader(att);
- out.write(("--" + boundary + LINE_SEP).getBytes());
+ out.write(("--" + boundary + "\r\n").getBytes());
out.write(soapHeader.getBytes());
- out.write(LINE_SEP.getBytes());
Object content = att.getDataHandler().getContent();
if (content instanceof InputStream) {
InputStream insAtt = (InputStream) content;
@@ -104,12 +97,9 @@
ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(content);
}
- if (!System.getProperty("file.separator").equals("/")) {
- out.write(LINE_SEP.getBytes());
- }
+ out.write("\r\n".getBytes());
}
- out.write(("--" + boundary + "--").getBytes());
- out.write(LINE_SEP.getBytes());
+ out.write(("--" + boundary + "--\r\n").getBytes());
out.flush();
// build contentType string for return
List<String> contentType = (List<String>) headers.get(HttpHeaderHelper.getHeaderKey(
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=479552&r1=479551&r2=479552
==============================================================================
--- 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 Mon Nov 27 01:02:03 2006
@@ -72,33 +72,27 @@
public static String getSoapPartHeader(Message message, String soapPartId, String action) {
StringBuffer buffer = new StringBuffer(200);
- if (System.getProperty("file.separator").equals("/")) {
- buffer.append("\n");
- }
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");
+ buffer.append("; action=" + action + "\"\r\n");
} else {
- buffer.append("\"\n");
+ buffer.append("\"\r\n");
}
- buffer.append("Content-Transfer-Encoding: binary\n");
- buffer.append("Content-ID: <" + soapPartId + ">\n");
+ buffer.append("Content-Transfer-Encoding: binary\r\n");
+ buffer.append("Content-ID: <" + soapPartId + ">\r\n\r\n");
return buffer.toString();
}
public static String getAttchmentPartHeader(Attachment att) {
StringBuffer buffer = new StringBuffer(200);
- if (System.getProperty("file.separator").equals("/")) {
- buffer.append("\n");
- }
buffer.append(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE) + ": "
- + att.getDataHandler().getContentType() + ";\n");
+ + att.getDataHandler().getContentType() + ";\r\n");
if (att.isXOP()) {
- buffer.append("Content-Transfer-Encoding: binary\n");
+ buffer.append("Content-Transfer-Encoding: binary\r\n");
}
- buffer.append("Content-ID: <" + att.getId() + ">\n");
+ buffer.append("Content-ID: <" + att.getId() + ">\r\n\r\n");
return buffer.toString();
}
@@ -118,10 +112,10 @@
public static String getMimeSubType(Message message, String soapPartId, String boundary) {
StringBuffer ct = new StringBuffer();
- ct.append("related; boundary=" + boundary + "; ");
+ ct.append("related; boundary=\"" + boundary + "\"; ");
ct.append("type=\"application/xop+xml\"; ");
ct.append("start=\"<" + soapPartId + ">\"; ");
- ct.append("start-info=\"" + message.getAttachmentMimeType() + "\"");
+ ct.append("start-info=" + message.getAttachmentMimeType());
return ct.toString();
}
}