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);
}
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;
}
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;
}
Aggregations