use of com.predic8.membrane.core.interceptor.ExchangeStoreInterceptor in project service-proxy by membrane.
the class Transport method init.
public void init(Router router) throws Exception {
this.router = router;
if (interceptors.isEmpty()) {
interceptors.add(new RuleMatchingInterceptor());
interceptors.add(new ExchangeStoreInterceptor(router.getExchangeStore()));
interceptors.add(new DispatchingInterceptor());
interceptors.add(new ReverseProxyingInterceptor());
interceptors.add(new UserFeatureInterceptor());
interceptors.add(new HTTPClientInterceptor());
}
for (Interceptor interceptor : interceptors) {
interceptor.init(router);
}
}
use of com.predic8.membrane.core.interceptor.ExchangeStoreInterceptor in project service-proxy by membrane.
the class AbortExchangeTest method setup.
@Before
public void setup() throws Exception {
router = new HttpRouter();
LimitedMemoryExchangeStore es = new LimitedMemoryExchangeStore();
router.setExchangeStore(es);
router.getTransport().getInterceptors().add(2, new ExchangeStoreInterceptor(es));
ServiceProxy sp2 = new ServiceProxy(new ServiceProxyKey("*", "*", ".*", 3031), "", -1);
sp2.getInterceptors().add(new AbstractInterceptor() {
@Override
public Outcome handleRequest(Exchange exc) throws Exception {
exc.getRequest().readBody();
exc.setResponse(Response.ok("").body(new InputStream() {
int l = 0;
@Override
public int read() throws IOException {
if (l >= 2000000)
return -1;
return 0;
}
}, true).build());
return Outcome.RETURN;
}
});
router.getRuleManager().addProxyAndOpenPortIfNew(sp2);
router.init();
}
Aggregations