SequenceMediator mainSeq = new SequenceMediator();
mainSeq.setName("main");
InMediator in = new InMediator();
OutMediator out = new OutMediator();
out.addChild(new SendMediator());
mainSeq.addChild(in);
mainSeq.addChild(out);
SendMediator send = new SendMediator();
LoadbalanceEndpoint lb = new LoadbalanceEndpoint();
FilterMediator filterMediator = new FilterMediator();
in.addChild(filterMediator);
SynapseXPath xpath = new SynapseXPath("get-property('To')");
filterMediator.setSource(xpath);
filterMediator.setRegex(Pattern.compile("/carbon"));
PropertyMediator httpSCProperty = new PropertyMediator();
httpSCProperty.setName("HTTP_SC");
httpSCProperty.setScope("axis2");
httpSCProperty.setValue("302");
PropertyMediator locationHeader = new PropertyMediator();
locationHeader.setName("Location");
locationHeader.setScope("transport");
locationHeader.setValue(getMasterHttpsEndpoint(PortSelector.normalEndpointList));
PropertyMediator responseProperty = new PropertyMediator();
responseProperty.setName(SynapseConstants.RESPONSE);
responseProperty.setValue("true");
HeaderMediator headerMediator = new HeaderMediator();
headerMediator.setQName(new QName("To"));
headerMediator.setAction(1);
SendMediator sendMediator = new SendMediator();
DropMediator dropMediator = new DropMediator();
filterMediator.addChild(locationHeader);
filterMediator.addChild(httpSCProperty);
filterMediator.addChild(responseProperty);