Author: veithen
Date: Sun Apr 22 18:11:43 2012
New Revision: 1328921
URL: http://svn.apache.org/viewvc?rev=1328921&view=rev
Log:
Some code simplifications using Axiom features.
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/utility/DataSourceFormatter.java
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/WrappedDataHandler.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/utility/DataSourceFormatter.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/utility/DataSourceFormatter.java?rev=1328921&r1=1328920&r2=1328921&view=diff
==
---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/utility/DataSourceFormatter.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/utility/DataSourceFormatter.java
Sun Apr 22 18:11:43 2012
@@ -23,13 +23,13 @@ import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMOutputFormat;
import org.apache.axiom.om.OMSourcedElement;
import org.apache.axiom.om.impl.OMMultipartWriter;
-import org.apache.axiom.util.activation.DataHandlerWrapper;
import org.apache.axis2.AxisFault;
import org.apache.axis2.jaxws.handler.AttachmentsAdapter;
import org.apache.axis2.jaxws.message.databinding.DataSourceBlock;
import org.apache.axis2.transport.MessageFormatter;
import org.apache.axis2.transport.http.ApplicationXMLFormatter;
import org.apache.axis2.transport.http.util.URLTemplatingUtil;
+import org.apache.axis2.util.WrappedDataHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -70,11 +70,7 @@ public class DataSourceFormatter impleme
OMMultipartWriter mpw = new OMMultipartWriter(outputStream,
format);
DataHandler rootDataHandler = new DataHandler(busObject);
if (!rootDataHandler.getContentType().equals(contentType)) {
-rootDataHandler = new DataHandlerWrapper(rootDataHandler) {
-public String getContentType() {
-return contentType;
-}
-};
+rootDataHandler = new WrappedDataHandler(rootDataHandler,
contentType);
}
try {
mpw.writePart(rootDataHandler, format.getRootContentId());
Modified:
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/WrappedDataHandler.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/WrappedDataHandler.java?rev=1328921&r1=1328920&r2=1328921&view=diff
==
---
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/WrappedDataHandler.java
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/WrappedDataHandler.java
Sun Apr 22 18:11:43 2012
@@ -19,17 +19,9 @@
package org.apache.axis2.util;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.activation.CommandInfo;
-import javax.activation.CommandMap;
import javax.activation.DataHandler;
-import javax.activation.DataSource;
+import org.apache.axiom.util.activation.DataHandlerWrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -39,41 +31,11 @@ import org.apache.commons.logging.LogFac
* the DataHandler instance. We'll delegate all method calls except for
getContentType()
* to the real DataHandler instance.
*/
-public class WrappedDataHandler extends DataHandler {
+public class WrappedDataHandler extends DataHandlerWrapper {
private static final Log log = LogFactory.getLog(WrappedDataHandler.class);
-DataHandler delegate;
-String contentType;
-
-private static FakeDataSource FAKE_DS = new FakeDataSource();
-
-// This class is simply used as a fake DataSource implementation so that
the
-// WrappedDataHandler class can call it's superclass's ctor with a non-null
-// value that implements DataSource. The FakeDataSource instance will
never
-// be used, however. It's simply a placeholder.
-private static class FakeDataSource implements DataSource {
-
-
-public String getContentType() {
-return "application/octet-stream";
-}
-
-
-public InputStream getInputStream() throws IOException {
-throw new UnsupportedOperationException();
-}
-
-
-public String getName() {
-return "FakeDataSource";
-}
-
-
-public OutputStream getOutputStream() throws IOException {
-