You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2008/08/07 12:10:04 UTC
svn commit: r683574 - in /cxf/trunk:
rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
systests/src/test/java/org/apache/cxf/systest/local_transport/DirectDispatchClientTest.java
Author: ffang
Date: Thu Aug 7 03:10:04 2008
New Revision: 683574
URL: http://svn.apache.org/viewvc?rev=683574&view=rev
Log:
[CXF-1738]AbstractWSDLBasedEndpointFactory should setTransportId for local and camel transport according to the publish address
Modified:
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/local_transport/DirectDispatchClientTest.java
Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java?rev=683574&r1=683573&r2=683574&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java (original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java Thu Aug 7 03:10:04 2008
@@ -145,7 +145,12 @@
if (ei == null) {
ei = createEndpointInfo();
} else if (getAddress() != null) {
- ei.setAddress(getAddress());
+ ei.setAddress(getAddress());
+ if (ei.getAddress().startsWith("camel")
+ || ei.getAddress().startsWith("local")) {
+ modifyTransportIdPerAddress(ei);
+ }
+
}
} else if (getAddress() != null) {
ei.setAddress(getAddress());
@@ -186,6 +191,35 @@
}
return ep;
}
+ private void modifyTransportIdPerAddress(EndpointInfo ei) {
+ //get chance to set transportId according to the the publish address prefix
+ //this is useful for local & camel transport
+ if (transportId == null && getAddress() != null) {
+ DestinationFactory df = getDestinationFactory();
+ if (df == null) {
+ DestinationFactoryManager dfm = getBus().getExtension(
+ DestinationFactoryManager.class);
+ df = dfm.getDestinationFactoryForUri(getAddress());
+ }
+
+ if (df != null) {
+ transportId = df.getTransportIds().get(0);
+ } else {
+ // check conduits (the address could be supported on
+ // client only)
+ ConduitInitiatorManager cim = getBus().getExtension(
+ ConduitInitiatorManager.class);
+ ConduitInitiator ci = cim
+ .getConduitInitiatorForUri(getAddress());
+ if (ci != null) {
+ transportId = ci.getTransportIds().get(0);
+ }
+ }
+ }
+ if (transportId != null) {
+ ei.setTransportId(transportId);
+ }
+ }
protected void initializeServiceFactory() {
Class cls = getServiceClass();
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/local_transport/DirectDispatchClientTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/local_transport/DirectDispatchClientTest.java?rev=683574&r1=683573&r2=683574&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/local_transport/DirectDispatchClientTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/local_transport/DirectDispatchClientTest.java Thu Aug 7 03:10:04 2008
@@ -30,12 +30,8 @@
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
-import org.apache.cxf.binding.soap.SoapTransportFactory;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
-import org.apache.cxf.transport.ConduitInitiatorManager;
-import org.apache.cxf.transport.DestinationFactoryManager;
import org.apache.cxf.transport.local.LocalConduit;
-import org.apache.cxf.transport.local.LocalTransportFactory;
import org.apache.hello_world_soap_http.Greeter;
import org.junit.BeforeClass;
@@ -52,7 +48,6 @@
@BeforeClass
public static void startServers() throws Exception {
staticBus = BusFactory.getDefaultBus();
- setupLocalTransport(staticBus);
BusFactory.setThreadDefaultBus(staticBus);
assertTrue("server did not launch correctly", launchServer(Server.class, true));
}
@@ -67,27 +62,6 @@
invokeService(false);
}
- public static void setupLocalTransport(Bus bus) {
- DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
-
- SoapTransportFactory soapDF = new SoapTransportFactory();
- soapDF.setBus(bus);
- dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/", soapDF);
- dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/", soapDF);
-
-
- LocalTransportFactory localTransport = new LocalTransportFactory();
- dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", localTransport);
- dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport);
- dfm.registerDestinationFactory("http://cxf.apache.org/bindings/xformat", localTransport);
- dfm.registerDestinationFactory("http://cxf.apache.org/transports/local", localTransport);
-
- ConduitInitiatorManager extension = bus.getExtension(ConduitInitiatorManager.class);
- extension.registerConduitInitiator("http://cxf.apache.org/transports/local", localTransport);
- extension.registerConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport);
- extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/http", localTransport);
- extension.registerConduitInitiator("http://cxf.apache.org/bindings/xformat", localTransport);
- }
private void invokeService(boolean isDirectDispatch) {
BusFactory.setThreadDefaultBus(staticBus);