use of org.apache.cxf.transport.Conduit in project cxf by apache.
the class LoadDistributorTargetSelector method selectConduit.
/**
* Called when a Conduit is actually required.
*
* @param message
* @return the Conduit to use for mediation of the message
*/
public synchronized Conduit selectConduit(Message message) {
Conduit c = message.get(Conduit.class);
if (c != null) {
return c;
}
Exchange exchange = message.getExchange();
InvocationKey key = new InvocationKey(exchange);
InvocationContext invocation = inProgress.get(key);
if ((invocation != null) && !invocation.getContext().containsKey(IS_DISTRIBUTED)) {
Endpoint target = getDistributionTarget(exchange, invocation);
if (target != null) {
setEndpoint(target);
message.put(Message.ENDPOINT_ADDRESS, target.getEndpointInfo().getAddress());
message.put(CONDUIT_COMPARE_FULL_URL, Boolean.TRUE);
overrideAddressProperty(invocation.getContext());
invocation.getContext().put(IS_DISTRIBUTED, null);
}
}
return getSelectedConduit(message);
}
use of org.apache.cxf.transport.Conduit in project cxf by apache.
the class JettyHTTPDestinationTest method testGetBackChannelSendDecoupled.
@Test
public void testGetBackChannelSendDecoupled() throws Exception {
destination = setUpDestination(false, false);
setUpDoService(false, true, true, 202);
destination.doService(request, response);
setUpInMessage();
Message partialResponse = setUpOutMessage();
partialResponse.put(Message.PARTIAL_RESPONSE_MESSAGE, Boolean.TRUE);
Conduit partialBackChannel = destination.getBackChannel(inMessage);
partialBackChannel.prepare(partialResponse);
verifyBackChannelSend(partialBackChannel, partialResponse, 202);
outMessage = setUpOutMessage();
Conduit fullBackChannel = destination.getBackChannel(inMessage);
fullBackChannel.prepare(outMessage);
}
use of org.apache.cxf.transport.Conduit in project cxf by apache.
the class JettyHTTPDestinationTest method testGetBackChannelSendOneway.
@Test
public void testGetBackChannelSendOneway() throws Exception {
destination = setUpDestination(false, false);
setUpDoService(false, true, 500);
destination.doService(request, response);
setUpInMessage();
Conduit backChannel = destination.getBackChannel(inMessage);
outMessage = setUpOutMessage();
backChannel.prepare(outMessage);
verifyBackChannelSend(backChannel, outMessage, 500, true);
}
use of org.apache.cxf.transport.Conduit in project cxf by apache.
the class JettyHTTPDestinationTest method testGetBackChannelSendFault.
@Test
public void testGetBackChannelSendFault() throws Exception {
destination = setUpDestination(false, false);
setUpDoService(false, true, 500);
destination.doService(request, response);
setUpInMessage();
Conduit backChannel = destination.getBackChannel(inMessage);
outMessage = setUpOutMessage();
backChannel.prepare(outMessage);
verifyBackChannelSend(backChannel, outMessage, 500);
}
use of org.apache.cxf.transport.Conduit in project cxf by apache.
the class NettyHttpDestinationTest method testGetBackChannelSendDecoupled.
@Test
public void testGetBackChannelSendDecoupled() throws Exception {
destination = setUpDestination(false, false);
setUpDoService(false, true, true, 202);
destination.doService(request, response);
setUpInMessage();
Message partialResponse = setUpOutMessage();
partialResponse.put(Message.PARTIAL_RESPONSE_MESSAGE, Boolean.TRUE);
Conduit partialBackChannel = destination.getBackChannel(inMessage);
partialBackChannel.prepare(partialResponse);
verifyBackChannelSend(partialBackChannel, partialResponse, 202);
outMessage = setUpOutMessage();
Conduit fullBackChannel = destination.getBackChannel(inMessage);
fullBackChannel.prepare(outMessage);
}
Aggregations