Java Code Examples for org.apache.cxf.transport.ConduitInitiatorManager#getConduitInitiatorForUri()

The following examples show how to use org.apache.cxf.transport.ConduitInitiatorManager#getConduitInitiatorForUri() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractServiceFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
protected String detectTransportIdFromAddress(String ad) {
    ConduitInitiatorManager cim = getBus().getExtension(ConduitInitiatorManager.class);
    ConduitInitiator ci = cim.getConduitInitiatorForUri(getAddress());
    if (ci != null) {
        return ci.getTransportIds().get(0);
    }
    return null;
}
 
Example 2
Source File: AbstractWSDLBasedEndpointFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example 3
Source File: ClientFactoryBean.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
protected String detectTransportIdFromAddress(String ad) {
    ConduitInitiatorManager cim = getBus().getExtension(ConduitInitiatorManager.class);
    ConduitInitiator ci = cim.getConduitInitiatorForUri(getAddress());
    if (ci != null) {
        return ci.getTransportIds().get(0);
    }
    return null;
}
 
Example 4
Source File: SoapTransportFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Conduit getConduit(EndpointInfo ei, EndpointReferenceType target, Bus bus) throws IOException {
    String address = target == null ? ei.getAddress() : target.getAddress().getValue();
    BindingInfo bi = ei.getBinding();
    String transId = ei.getTransportId();
    if (bi instanceof SoapBindingInfo) {
        transId = ((SoapBindingInfo)bi).getTransportURI();
        if (transId == null) {
            transId = ei.getTransportId();
        }
    }
    ConduitInitiator conduitInit;
    try {
        ConduitInitiatorManager mgr = bus.getExtension(ConduitInitiatorManager.class);
        if (StringUtils.isEmpty(address)
            || address.startsWith("http")
            || address.startsWith("jms")
            || address.startsWith("soap.udp")) {
            conduitInit = mgr.getConduitInitiator(mapTransportURI(transId, address));
        } else {
            conduitInit = mgr.getConduitInitiatorForUri(address);
        }
        if (conduitInit == null) {
            throw new RuntimeException(String.format(CANNOT_GET_CONDUIT_ERROR, address, transId));
        }
        return conduitInit.getConduit(ei, target, bus);
    } catch (BusException e) {
        throw new RuntimeException(String.format(CANNOT_GET_CONDUIT_ERROR, address, transId));
    }
}
 
Example 5
Source File: ServiceUtils.java    From fuchsia with Apache License 2.0 5 votes vote down vote up
public static String getTransportId(Bus bus, String address) {
    ConduitInitiatorManager conduitInitiatorMgr = bus
            .getExtension(ConduitInitiatorManager.class);
    ConduitInitiator conduitInitiator = null;

    if (conduitInitiatorMgr != null) {
        conduitInitiator = conduitInitiatorMgr
                .getConduitInitiatorForUri(address);
    }
    if (conduitInitiator != null) {
        return conduitInitiator.getTransportIds().get(0);
    } else {
        return null;
    }
}