Search in sources :

Example 1 with DeferredConduitSelector

use of org.apache.cxf.endpoint.DeferredConduitSelector in project cxf by apache.

the class ColocFeature method initialize.

@Override
public void initialize(Client client, Bus bus) {
    ConduitSelector selector = new DeferredConduitSelector();
    selector.setEndpoint(client.getEndpoint());
    client.setConduitSelector(selector);
    initializeProvider(client, bus);
}
Also used : ConduitSelector(org.apache.cxf.endpoint.ConduitSelector) DeferredConduitSelector(org.apache.cxf.endpoint.DeferredConduitSelector) DeferredConduitSelector(org.apache.cxf.endpoint.DeferredConduitSelector)

Example 2 with DeferredConduitSelector

use of org.apache.cxf.endpoint.DeferredConduitSelector in project cxf by apache.

the class Proxy method createClient.

protected Client createClient(Bus bus, Endpoint endpoint, final ProtocolVariation protocol, Conduit conduit, final EndpointReferenceType address) {
    ConduitSelector cs = new DeferredConduitSelector(conduit) {

        @Override
        public synchronized Conduit selectConduit(Message message) {
            Conduit conduit = null;
            EndpointInfo endpointInfo = getEndpoint().getEndpointInfo();
            EndpointReferenceType original = endpointInfo.getTarget();
            try {
                if (null != address) {
                    endpointInfo.setAddress(address);
                }
                conduit = super.selectConduit(message);
            } finally {
                endpointInfo.setAddress(original);
            }
            return conduit;
        }
    };
    RMClient client = new RMClient(bus, endpoint, cs);
    // WS-RM requires ws-addressing
    WSAddressingFeature wsa = new WSAddressingFeature();
    wsa.setAddressingRequired(true);
    wsa.initialize(client, bus);
    Map<String, Object> context = client.getRequestContext();
    context.put(MAPAggregator.ADDRESSING_NAMESPACE, protocol.getWSANamespace());
    context.put(RMManager.WSRM_VERSION_PROPERTY, protocol.getWSRMNamespace());
    context.put(RMManager.WSRM_WSA_VERSION_PROPERTY, protocol.getWSANamespace());
    return client;
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) WSAddressingFeature(org.apache.cxf.ws.addressing.WSAddressingFeature) Message(org.apache.cxf.message.Message) Conduit(org.apache.cxf.transport.Conduit) ConduitSelector(org.apache.cxf.endpoint.ConduitSelector) DeferredConduitSelector(org.apache.cxf.endpoint.DeferredConduitSelector) DeferredConduitSelector(org.apache.cxf.endpoint.DeferredConduitSelector)

Example 3 with DeferredConduitSelector

use of org.apache.cxf.endpoint.DeferredConduitSelector in project cxf by apache.

the class RetransmissionQueueImpl method buildConduit.

/**
 * @param message
 * @param endpoint
 * @param to
 * @return
 */
protected Conduit buildConduit(SoapMessage message, final Endpoint endpoint, AttributedURIType to) {
    Conduit c;
    final String address = to.getValue();
    DeferredConduitSelector cs = new DeferredConduitSelector() {

        @Override
        public synchronized Conduit selectConduit(Message message) {
            Conduit conduit = null;
            EndpointInfo endpointInfo = endpoint.getEndpointInfo();
            EndpointReferenceType original = endpointInfo.getTarget();
            try {
                if (null != address) {
                    endpointInfo.setAddress(address);
                }
                conduit = super.selectConduit(message);
            } finally {
                endpointInfo.setAddress(original);
            }
            conduits.clear();
            return conduit;
        }
    };
    cs.setEndpoint(endpoint);
    c = cs.selectConduit(message);
    // REVISIT
    // use application endpoint message observer instead?
    c.setMessageObserver(new MessageObserver() {

        public void onMessage(Message message) {
            LOG.fine("Ignoring response to resent message.");
        }
    });
    cs.close();
    message.getExchange().setConduit(c);
    return c;
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) MessageObserver(org.apache.cxf.transport.MessageObserver) SoapMessage(org.apache.cxf.binding.soap.SoapMessage) Message(org.apache.cxf.message.Message) Conduit(org.apache.cxf.transport.Conduit) DeferredConduitSelector(org.apache.cxf.endpoint.DeferredConduitSelector)

Aggregations

DeferredConduitSelector (org.apache.cxf.endpoint.DeferredConduitSelector)3 ConduitSelector (org.apache.cxf.endpoint.ConduitSelector)2 Message (org.apache.cxf.message.Message)2 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)2 Conduit (org.apache.cxf.transport.Conduit)2 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)2 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)1 MessageObserver (org.apache.cxf.transport.MessageObserver)1 WSAddressingFeature (org.apache.cxf.ws.addressing.WSAddressingFeature)1