You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dk...@apache.org on 2011/10/17 05:04:58 UTC
svn commit: r1184984 - in /camel/trunk/components/camel-cxf/src:
main/java/org/apache/camel/component/cxf/
main/java/org/apache/camel/component/cxf/feature/
test/java/org/apache/camel/component/cxf/soap/headers/
test/resources/org/apache/camel/componen...
Author: dkulp
Date: Mon Oct 17 03:04:58 2011
New Revision: 1184984
URL: http://svn.apache.org/viewvc?rev=1184984&view=rev
Log:
Add a flag and system property to control whether streaming is used or
not.
Modified:
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest.java
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest-context.xml
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=1184984&r1=1184983&r2=1184984&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Mon Oct 17 03:04:58 2011
@@ -112,6 +112,7 @@ public class CxfEndpoint extends Default
private boolean isWrapped;
// This is for marshal or unmarshal message with the document-literal wrapped or unwrapped style
private Boolean wrappedStyle;
+ private Boolean allowStreaming;
private DataFormat dataFormat = DataFormat.POJO;
private String publishedEndpointUrl;
private boolean inOut = true;
@@ -245,7 +246,7 @@ public class CxfEndpoint extends Default
// apply feature here
if (!CxfEndpointUtils.hasAnnotation(cls, WebServiceProvider.class)) {
if (getDataFormat() == DataFormat.PAYLOAD) {
- sfb.getFeatures().add(new PayLoadDataFormatFeature());
+ sfb.getFeatures().add(new PayLoadDataFormatFeature(allowStreaming));
} else if (getDataFormat() == DataFormat.MESSAGE) {
sfb.getFeatures().add(new MessageDataFormatFeature());
}
@@ -400,7 +401,7 @@ public class CxfEndpoint extends Default
if (getDataFormat() == DataFormat.MESSAGE) {
factoryBean.getFeatures().add(new MessageDataFormatFeature());
} else if (getDataFormat() == DataFormat.PAYLOAD) {
- factoryBean.getFeatures().add(new PayLoadDataFormatFeature());
+ factoryBean.getFeatures().add(new PayLoadDataFormatFeature(allowStreaming));
factoryBean.setDataBinding(new HybridSourceDataBinding());
}
@@ -629,6 +630,13 @@ public class CxfEndpoint extends Default
public void setWrappedStyle(Boolean wrapped) {
wrappedStyle = wrapped;
}
+
+ public void setAllowStreaming(Boolean b) {
+ allowStreaming = b;
+ }
+ public Boolean getAllowStreaming() {
+ return allowStreaming;
+ }
public void setCxfBinding(CxfBinding cxfBinding) {
this.cxfBinding = cxfBinding;
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java?rev=1184984&r1=1184983&r2=1184984&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java Mon Oct 17 03:04:58 2011
@@ -47,12 +47,26 @@ import org.slf4j.LoggerFactory;
public class PayLoadDataFormatFeature extends AbstractDataFormatFeature {
private static final Logger LOG = LoggerFactory.getLogger(PayLoadDataFormatFeature.class);
private static final Collection<Class> REMOVING_FAULT_IN_INTERCEPTORS;
-
+ private static final boolean DEFAULT_ALLOW_STREAMING;
static {
REMOVING_FAULT_IN_INTERCEPTORS = new ArrayList<Class>();
REMOVING_FAULT_IN_INTERCEPTORS.add(ClientFaultConverter.class);
+
+ String s = System.getProperty("org.apache.camel.component.cxf.streaming");
+ DEFAULT_ALLOW_STREAMING = s == null || Boolean.parseBoolean(s);
}
+ boolean allowStreaming = DEFAULT_ALLOW_STREAMING;
+
+ public PayLoadDataFormatFeature() {
+ }
+ public PayLoadDataFormatFeature(Boolean streaming) {
+ if (streaming != null) {
+ allowStreaming = streaming;
+ }
+ }
+
+
@Override
public void initialize(Client client, Bus bus) {
removeFaultInInterceptorFromClient(client);
@@ -112,9 +126,9 @@ public class PayLoadDataFormatFeature ex
for (int x = 0; x < size; x++) {
//last part can be streamed, others need DOM parsing
if (x < (size - 1)) {
- bmi.getMessageParts().get(x).setTypeClass(DOMSource.class);
+ bmi.getMessageParts().get(x).setTypeClass(allowStreaming ? DOMSource.class : null);
} else {
- bmi.getMessageParts().get(x).setTypeClass(Source.class);
+ bmi.getMessageParts().get(x).setTypeClass(allowStreaming ? Source.class : null);
}
}
}
@@ -125,9 +139,9 @@ public class PayLoadDataFormatFeature ex
for (int x = 0; x < size; x++) {
//last part can be streamed, others need DOM parsing
if (x < (size - 1)) {
- msgInfo.getMessageParts().get(x).setTypeClass(DOMSource.class);
+ msgInfo.getMessageParts().get(x).setTypeClass(allowStreaming ? DOMSource.class : null);
} else {
- msgInfo.getMessageParts().get(x).setTypeClass(Source.class);
+ msgInfo.getMessageParts().get(x).setTypeClass(allowStreaming ? Source.class : null);
}
}
}
Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest.java?rev=1184984&r1=1184983&r2=1184984&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest.java (original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest.java Mon Oct 17 03:04:58 2011
@@ -434,7 +434,9 @@ public class CxfMessageHeadersRelayTest
});
CxfPayload<?> out = exchange.getOut().getBody(CxfPayload.class);
- assertEquals(1, out.getBody().size());
+ assertEquals(1, out.getBodySources().size());
+
+ assertTrue(out.getBodySources().get(0) instanceof DOMSource);
assertEquals(0, out.getHeaders().size());
Modified: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest-context.xml?rev=1184984&r1=1184983&r2=1184984&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest-context.xml (original)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest-context.xml Mon Oct 17 03:04:58 2011
@@ -72,6 +72,7 @@
xmlns:tns="http://apache.org/camel/component/cxf/soap/headers">
<cxf:properties>
<entry key="dataFormat" value="PAYLOAD"/>
+ <entry key="allowStreaming" value="false"/>
</cxf:properties>
</cxf:cxfEndpoint>