You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2010/05/18 04:08:51 UTC
svn commit: r945459 - in
/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc:
CxfBcConsumer.java interceptors/SetStatusInterceptor.java
Author: ffang
Date: Tue May 18 02:08:51 2010
New Revision: 945459
URL: http://svn.apache.org/viewvc?rev=945459&view=rev
Log:
[SMXCOMP-746] cxf bc consumer should defer to return DONE ME to handle the response streamsource
Added:
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/SetStatusInterceptor.java
Modified:
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=945459&r1=945458&r2=945459&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java Tue May 18 02:08:51 2010
@@ -112,6 +112,7 @@ import org.apache.servicemix.cxfbc.inter
import org.apache.servicemix.cxfbc.interceptors.JbiFault;
import org.apache.servicemix.cxfbc.interceptors.SchemaValidationInInterceptor;
import org.apache.servicemix.cxfbc.interceptors.SchemaValidationOutInterceptor;
+import org.apache.servicemix.cxfbc.interceptors.SetStatusInterceptor;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.soap.util.DomUtil;
import org.mortbay.jetty.Handler;
@@ -292,6 +293,8 @@ public class CxfBcConsumer extends Consu
return;
}
Message message = messages.remove(exchange.getExchangeId());
+ message.setContent(MessageExchange.class, exchange);
+ message.put("needSetDone", Boolean.TRUE);
synchronized (message.getInterceptorChain()) {
boolean oneway = message.getExchange().get(
BindingOperationInfo.class).getOperationInfo().isOneWay();
@@ -306,11 +309,7 @@ public class CxfBcConsumer extends Consu
isSTFlow = true;
}
}
- if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
- exchange.setStatus(ExchangeStatus.DONE);
- message.getExchange().get(ComponentContext.class)
- .getDeliveryChannel().send(exchange);
- }
+
}
}
@@ -482,6 +481,8 @@ public class CxfBcConsumer extends Consu
new JbiOutWsdl1Interceptor(isUseJBIWrapper(), isUseSOAPEnvelope()));
cxfService.getOutInterceptors().add(
new ExtractHeaderPartIntercepor());
+ cxfService.getOutInterceptors().add(
+ new SetStatusInterceptor());
cxfService.getOutInterceptors().add(new SoapActionOutInterceptor());
cxfService.getOutInterceptors().add(new AttachmentOutInterceptor());
@@ -903,7 +904,8 @@ public class CxfBcConsumer extends Consu
outMessage = endpoint.getBinding().createMessage();
ex.setOutMessage(outMessage);
}
-
+ outMessage.setContent(MessageExchange.class, exchange);
+ outMessage.put("needSetDone", message.get("needSetDone"));
NormalizedMessage norMessage = (NormalizedMessage) exchange
.getMessage("out");
@@ -928,8 +930,9 @@ public class CxfBcConsumer extends Consu
outMessage.setAttachments(attachmentList);
}
+
}
-
+
}
public void handleFault(Message message) {
Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/SetStatusInterceptor.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/SetStatusInterceptor.java?rev=945459&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/SetStatusInterceptor.java (added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/SetStatusInterceptor.java Tue May 18 02:08:51 2010
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicemix.cxfbc.interceptors;
+
+import javax.jbi.component.ComponentContext;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.MessageExchange;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class SetStatusInterceptor extends AbstractPhaseInterceptor<Message> {
+
+
+ public SetStatusInterceptor() {
+ super(Phase.MARSHAL);
+ addAfter(JbiOutWsdl1Interceptor.class.getName());
+ }
+
+ public void handleMessage(Message message) throws Fault {
+ MessageExchange exchange = message
+ .getContent(MessageExchange.class);
+ try {
+ if (message.get("needSetDone") != null
+ && message.get("needSetDone").equals(Boolean.TRUE)
+ && exchange.getStatus() == ExchangeStatus.ACTIVE) {
+ exchange.setStatus(ExchangeStatus.DONE);
+ message.getExchange().get(ComponentContext.class)
+ .getDeliveryChannel().send(exchange);
+ }
+ } catch (Exception e) {
+ throw new Fault(e);
+ }
+ }
+
+}