Skip to content

Commit

Permalink
Added parameters for ConditionalInterceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
t-burch committed Oct 25, 2023
1 parent 535ccd5 commit f65457c
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
import java.util.*;
import java.util.function.*;

import static com.predic8.membrane.core.interceptor.Interceptor.Flow.REQUEST;
import static com.predic8.membrane.core.interceptor.Outcome.*;
import static com.predic8.membrane.core.interceptor.flow.ConditionalInterceptor.LanguageType.*;
import static com.predic8.membrane.core.lang.ScriptingUtils.createParameterBindings;

/**
* @description <p>
Expand Down Expand Up @@ -69,8 +71,15 @@ public void init(Router router) throws Exception {
}

private boolean testCondition(Exchange exc) {
HashMap<String, Object> parameters = new HashMap<>();
parameters.put("exc", exc);
HashMap<String, Object> parameters = new HashMap<>() {{
put("Outcome", Outcome.class);
put("RETURN", RETURN);
put("CONTINUE", CONTINUE);
put("ABORT", Outcome.ABORT);
put("spring", router.getBeanFactory());
put("exc", exc);
}};
parameters.putAll(createParameterBindings(router.getUriFactory(), exc, exc.getRequest(), REQUEST, false));
return condition.apply(parameters);
}

Expand Down

0 comments on commit f65457c

Please sign in to comment.