Author: jim.ma
Date: 2011-04-21 22:27:35 -0400 (Thu, 21 Apr 2011)
New Revision: 14183
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/xop/jaxws/AttachmentMarshallerImpl.java
Log:
[JBWS-3277]:Use ByteArrayDataSource to create all DataHandlers
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/xop/jaxws/AttachmentMarshallerImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/xop/jaxws/AttachmentMarshallerImpl.java 2011-04-21
21:04:57 UTC (rev 14182)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/xop/jaxws/AttachmentMarshallerImpl.java 2011-04-22
02:27:35 UTC (rev 14183)
@@ -102,20 +102,11 @@
public String addMtomAttachment(byte[] data, int offset, int length,
String mimeType, String elementNamespace, String
elementLocalName)
{
-
- DataHandler dh = null;
- String contentType = "application/octet-stream";
- if (mimeType.contains("xml") || mimeType.contains("text") ||
mimeType.contains("html"))
- {
- contentType = mimeType;
- ByteArrayDataSource ds = new ByteArrayDataSource(data, offset, length);
- ds.setContentType(contentType);
- dh = new DataHandler(ds);
- } else {
- dh = new DataHandler(data, contentType);
- }
-
-
+
+ String contentType = mimeType == null ? "application/octet-stream" :
mimeType;
+ ByteArrayDataSource ds = new ByteArrayDataSource(data, offset, length);
+ ds.setContentType(contentType);
+ DataHandler dh = new DataHandler(ds);
return addMtomAttachment(dh, elementNamespace, elementLocalName);
}
Show replies by date