Skip to content

Commit 8586812

Browse files
veithengregturn
authored andcommitted
SWS-987 - Use AbstractPushOMDataSource to enable additional optimizations in Axiom
1 parent f189e86 commit 8586812

File tree

1 file changed

+4
-34
lines changed

1 file changed

+4
-34
lines changed

spring-ws-core/src/main/java/org/springframework/ws/soap/axiom/StreamingOMDataSource.java

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,13 @@
1616

1717
package org.springframework.ws.soap.axiom;
1818

19-
import java.io.ByteArrayInputStream;
20-
import java.io.ByteArrayOutputStream;
21-
import java.io.OutputStream;
22-
import java.io.Writer;
2319
import javax.xml.stream.XMLStreamException;
24-
import javax.xml.stream.XMLStreamReader;
2520
import javax.xml.stream.XMLStreamWriter;
2621

2722
import org.apache.axiom.om.OMDataSource;
28-
import org.apache.axiom.om.OMOutputFormat;
29-
import org.apache.axiom.om.util.StAXUtils;
23+
import org.apache.axiom.om.ds.AbstractPushOMDataSource;
3024

3125
import org.springframework.util.Assert;
32-
import org.springframework.util.StringUtils;
3326
import org.springframework.ws.stream.StreamingPayload;
3427

3528
/**
@@ -38,7 +31,7 @@
3831
* @author Arjen Poutsma
3932
* @since 2.0
4033
*/
41-
class StreamingOMDataSource implements OMDataSource {
34+
class StreamingOMDataSource extends AbstractPushOMDataSource {
4235

4336
private final StreamingPayload payload;
4437

@@ -48,36 +41,13 @@ class StreamingOMDataSource implements OMDataSource {
4841
}
4942

5043
@Override
51-
public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
52-
XMLStreamWriter streamWriter;
53-
if (format != null && StringUtils.hasLength(format.getCharSetEncoding())) {
54-
streamWriter = StAXUtils.createXMLStreamWriter(output, format.getCharSetEncoding());
55-
}
56-
else {
57-
streamWriter = StAXUtils.createXMLStreamWriter(output);
58-
}
59-
serialize(streamWriter);
60-
}
61-
62-
@Override
63-
public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {
64-
XMLStreamWriter streamWriter = StAXUtils.createXMLStreamWriter(writer);
65-
serialize(streamWriter);
44+
public boolean isDestructiveWrite() {
45+
return false;
6646
}
6747

6848
@Override
6949
public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
7050
payload.writeTo(xmlWriter);
71-
xmlWriter.flush();
72-
}
73-
74-
@Override
75-
public XMLStreamReader getReader() throws XMLStreamException {
76-
ByteArrayOutputStream bos = new ByteArrayOutputStream();
77-
serialize(bos, null);
78-
79-
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
80-
return StAXUtils.createXMLStreamReader(bis);
8151
}
8252

8353
}

0 commit comments

Comments
 (0)