use of com.predic8.membrane.core.interceptor.HeaderFilterInterceptor.Rule in project service-proxy by membrane.
the class AbstractExchangeStore method notifyListenersOnExchangeAdd.
public void notifyListenersOnExchangeAdd(Rule rule, AbstractExchange exchange) {
for (IExchangesStoreListener listener : exchangesStoreListeners) {
exchange.addExchangeStoreListener(listener);
listener.addExchange(rule, exchange);
}
}
use of com.predic8.membrane.core.interceptor.HeaderFilterInterceptor.Rule in project service-proxy by membrane.
the class ElasticSearchExchangeStore method removeAllExchanges.
@Override
public void removeAllExchanges(Rule rule) {
String name = rule.toString();
try {
Exchange exc = new Request.Builder().post(getElasticSearchExchangesPath() + "_delete_by_query").body("{\n" + " \"query\": {\n" + " \"bool\": {\n" + " \"must\": [\n" + " {\n" + " \"wildcard\": {\n" + " \"issuer\": \"" + documentPrefix + "\"\n" + " }\n" + " },\n" + " {\n" + " \"match\": {\n" + " \"rule.name\": \"" + name + "\"\n" + " }\n" + " }\n" + " ]\n" + " }\n" + " }\n" + "}").header("Content-Type", "application/json").buildExchange();
client.call(exc);
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.predic8.membrane.core.interceptor.HeaderFilterInterceptor.Rule in project service-proxy by membrane.
the class UserFeatureInterceptor method handleRequest.
@Override
public Outcome handleRequest(Exchange exc) throws Exception {
Rule predecessorRule = exc.getRule();
Outcome outcome = flowController.invokeRequestHandlers(exc, predecessorRule.getInterceptors());
while (isTargetInternalAndContinue(exc, outcome)) {
log.debug("routing to serviceProxy with name: " + getServiceProxyName(exc));
// rule matching
String destination = exc.getDestinations().get(0);
Rule newRule = getRuleByDest(destination);
if (newRule == null)
throw new Exception("No proxy found for destination " + destination);
exc.setRule(newRule);
// dispatching
exc.getDestinations().clear();
exc.getDestinations().add(DispatchingInterceptor.getForwardingDestination(exc));
// user feature
outcome = flowController.invokeRequestHandlers(exc, newRule.getInterceptors());
}
exc.setRule(predecessorRule);
return outcome;
}
use of com.predic8.membrane.core.interceptor.HeaderFilterInterceptor.Rule in project service-proxy by membrane.
the class ValidatorInterceptor method init.
@Override
public void init() throws Exception {
validator = null;
String baseLocation = router == null ? null : router.getBaseLocation();
if (wsdl != null) {
name = "SOAP Validator";
setValidator(new WSDLValidator(resourceResolver, ResolverMap.combine(baseLocation, wsdl), createFailureHandler(), skipFaults));
}
if (schema != null) {
name = "XML Schema Validator";
setValidator(new XMLSchemaValidator(resourceResolver, ResolverMap.combine(baseLocation, schema), createFailureHandler()));
}
if (jsonSchema != null) {
name = "JSON Schema Validator";
setValidator(new JSONValidator(resourceResolver, ResolverMap.combine(baseLocation, jsonSchema), createFailureHandler()));
}
if (schematron != null) {
name = "Schematron Validator";
setValidator(new SchematronValidator(resourceResolver, ResolverMap.combine(baseLocation, schematron), createFailureHandler(), router, applicationContext));
}
if (validator == null) {
Rule parent = router.getParentProxy(this);
if (parent instanceof SOAPProxy) {
wsdl = ((SOAPProxy) parent).getWsdl();
name = "SOAP Validator";
setValidator(new WSDLValidator(resourceResolver, ResolverMap.combine(baseLocation, wsdl), createFailureHandler(), skipFaults));
}
if (validator == null)
throw new Exception("<validator> must have an attribute specifying the validator.");
}
if (skipFaults && wsdl == null)
throw new Exception("validator/@skipFaults only makes sense with validator/@wsdl");
}
use of com.predic8.membrane.core.interceptor.HeaderFilterInterceptor.Rule in project service-proxy by membrane.
the class WSDLPublisherInterceptor method init.
@Override
public void init() throws Exception {
// inherit wsdl="..." from SoapProxy
if (wsdl == null) {
Rule parent = router.getParentProxy(this);
if (parent instanceof SOAPProxy) {
wsdl = ((SOAPProxy) parent).getWsdl();
setWsdl(wsdl);
}
}
}
Aggregations