// if this is not a response to a proxy service
String proxyName = (String) synCtx.getProperty(SynapseConstants.PROXY_SERVICE);
if (proxyName == null || "".equals(proxyName)) {
// set default fault handler
synCtx.pushFaultHandler(new MediatorFaultHandler(synCtx.getFaultSequence()));
if (receivingSequence != null) {
if (log.isDebugEnabled()) {
log.debug("Using Sequence with name: " + receivingSequence
+ " for injected message");
}
Mediator seqMediator = synCtx.getSequence(receivingSequence);
if (seqMediator != null) {
return seqMediator.mediate(synCtx);
} else {
log.warn("Cannot find a Sequence with name: " + receivingSequence
+ " for injecting the response message");
return false;
}
} else {
boolean processed = restHandler.process(synCtx);
if (processed) {
return true;
}
if (log.isDebugEnabled()) {
log.debug("Using Main Sequence for injected message");
}
return synCtx.getMainSequence().mediate(synCtx);
}
}
ProxyService proxyService = synCtx.getConfiguration().getProxyService(proxyName);
if (proxyService != null) {
if (proxyService.getTargetFaultSequence() != null) {
Mediator faultSequence = synCtx.getSequence(proxyService.getTargetFaultSequence());
if (faultSequence != null) {
synCtx.pushFaultHandler(new MediatorFaultHandler(faultSequence));
} else {
log.warn("Cloud not find any fault-sequence named :" +
proxyService.getTargetFaultSequence() + "; Setting the deafault" +
" fault sequence for out path");
synCtx.pushFaultHandler(new MediatorFaultHandler(synCtx.getFaultSequence()));
}
} else if (proxyService.getTargetInLineFaultSequence() != null) {
synCtx.pushFaultHandler(
new MediatorFaultHandler(proxyService.getTargetInLineFaultSequence()));
} else {
synCtx.pushFaultHandler(new MediatorFaultHandler(synCtx.getFaultSequence()));
}
Mediator outSequence = getProxyOutSequence(synCtx, proxyService);
if (receivingSequence != null) {
if (log.isDebugEnabled()) {